Created
October 16, 2019 06:41
-
-
Save boombang/fb380b6b306bf23ec53acf808db43d8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Piping: Chaining functions | |
foo = | |
Html.text (String.fromInt (add 5 (multiply 10 (divide 30 10)))) | |
-- x |> f = f x | |
baz = | |
divide 30 10 | |
|> multiply 10 | |
|> add 5 | |
|> String.fromInt | |
|> Html.text | |
-- Function composition | |
-- String.words : String -> List String | |
-- List.length : List a -> Int | |
-- (>>) : (a -> b) -> (b -> c) -> a -> c | |
wordCount = String.words >> List.length | |
-- wordCount : String -> Int | |
result = wordCount "use Elm and prosper" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment