Skip to content

Commit e21f1b2

Browse files
dkorpelntrel
andauthored
Apply suggestions from code review
Co-authored-by: Nick Treleaven <[email protected]>
1 parent e9a2327 commit e21f1b2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.dd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,11 @@ void main()
239239
{
240240
static foreach (c; "+-*/")
241241
if (sym == [c])
242-
return mixin("arr[0 .. $-2] ~
243-
(arr[$-2] " ~ c ~ " arr[$-1])");
242+
// replace the last 2 elements with the binary op
243+
return arr[0 .. $-2] ~
244+
mixin("arr[$-2] " ~ c ~ " arr[$-1]");
244245

246+
// sym must be a number
245247
return arr ~ sym.to!real;
246248
})((real[]).init).writeln;
247249
}

0 commit comments

Comments
 (0)