Elm (programming language): Difference between revisions

Content deleted Content added
No edit summary
Line 43:
 
-- let-expressions
keepEvenskeepEvens1 numbers =
let isEven n = n `mod` 2 == 0 in
filter isEven numbers
 
-- case-expression
keepEvens'keepEvens2 numbers =
case numbers of
{ hd : tl -> if hd `mod` 2 == 0 then hd : keepEvens'keepEvens2 tl else keepEvens'keepEvens2 tl
; [] -> [] }
 
-- anonymous functions
keepEvens''keepEvens3 numbers = filter (\n -> n `mod` 2 == 0) numbers
</source>
 
 
== External links ==