Pure functions are definitely a selling point. Random number generation needs to be in an isolated part of your app unless it's a toy. Because it deals with IO much like reading from disk, it should have a "hard"-ness to it.
Pure functions are definitely a selling point. Random number generation needs to be in an isolated part of your app unless it's a toy. Because it deals with IO much like reading from disk, it should have a "hard"-ness to it.
Good luck!
showUsers : [User] -> Html msg
showUsers users = div [id "my-component"] [ul [] (map showUser users)]
showUser : User -> Html msg
showUser user = li [] [
span [class "firstName"] [text user.firstName],
br [] [],
span [class "lastName"] [text user.lastName],
]FWIW, I wrote this without having previous Elm experience—the compiler's error messages are so good that it was mostly trial and error until it worked.
To your point: I think using language primitives for defining views instead of HTML templating is an advantage for Elm because you can write them using only the Elm language itself, without having to learn yet another syntax. Combined with the excellent compiler error messages, it makes writing views easier and less error prone than writing HTML templates.
What's even the "good luck!" part for? Good luck knowing about List.map?
How far do you think he got in Elm?
(def users
[{:firstname "john", :lastname "snow"} {:firstname "Peter",
:lastname "drucker"}])
(defn my-view
[]
[:ul
(for [{:keys [firstname lastname]} users]
[:li firstname " " lastname])])