Open ghost opened 4 years ago
I'm new to Elm and I'm loving your book. Thanks for all the effort you put into it.
I was reading this part of the List chapter (3.16) and found
isOdd number = if (remainderBy 2 number) == 0 then False else True
to be a bit "redundant". I don't know whether this affects performance or not (I did not get to benchmarking Elm code yet), but to me something like
isOdd number = (remainderBy 2 number) /= 0
feels more natural.
I did some testing in the REPL and it seems to work fine:
> isOdd number = | (remainderBy 2 number) /= 0 <function> : Int -> Bool > isOdd 10 False : Bool > isOdd 5 True : Bool > List.filter isOdd [ 0, 1, 2, 3, 4, 5 ] [1,3,5] : List Int
Thanks again for this amazing book.
I'm new to Elm and I'm loving your book. Thanks for all the effort you put into it.
I was reading this part of the List chapter (3.16) and found
to be a bit "redundant". I don't know whether this affects performance or not (I did not get to benchmarking Elm code yet), but to me something like
feels more natural.
I did some testing in the REPL and it seems to work fine:
Thanks again for this amazing book.