Elm (programming language): Difference between revisions

Content deleted Content added
Line 30:
The value of main is displayed on screen. Function asText turns any value into a displayable textual representation. Mouse.position is a value that changes over time, called a signal. Function lift ensures that asText is applied to Mouse.position every time the mouse moves.
 
Elm has a small but expressive set of language constructs, including if-expressions, let-expressions, case-expressions, and anonymous functions, and list interpolation.
Elm's list interpolation allows sequences of numbers to be easily created.
 
<source lang="haskell">
factorial n = product [1..n]
</source>
 
Elm has a small but expressive set of language constructs, including if-expressions, let-expressions, case-expressions, and anonymous functions.
 
<source lang="haskell">
Line 56 ⟶ 50:
-- anonymous functions
keepEvens3 numbers = filter (\n -> n `mod` 2 == 0) numbers
 
-- list interpolation
factorial n = product [1..n]
</source>