diff options
author | Guillermo Ramos | 2014-07-17 01:23:55 +0200 |
---|---|---|
committer | Guillermo Ramos | 2014-08-03 00:49:04 +0200 |
commit | 7a5cb6fcc133ed4a53ccbc484a5f0169e5b532de (patch) | |
tree | 9dda43b0bd96a8f2f247d163143bc96dd8b613b2 /elm | |
parent | 4022f2401399c0911103eaf7988fde4372b7f727 (diff) | |
download | 7l-7a5cb6fcc133ed4a53ccbc484a5f0169e5b532de.tar.gz |
[Elm] Día 1
Diffstat (limited to 'elm')
-rw-r--r-- | elm/.gitignore | 2 | ||||
-rw-r--r-- | elm/day1.elm | 26 |
2 files changed, 28 insertions, 0 deletions
diff --git a/elm/.gitignore b/elm/.gitignore new file mode 100644 index 0000000..ab307b2 --- /dev/null +++ b/elm/.gitignore @@ -0,0 +1,2 @@ +build +cache diff --git a/elm/day1.elm b/elm/day1.elm new file mode 100644 index 0000000..dd63919 --- /dev/null +++ b/elm/day1.elm @@ -0,0 +1,26 @@ +product = foldl (*) 1 + +xFields = map .x + +multiply x y = case y of + 0 -> 0 + y -> y + multiply x (y-1) + +type Person = { name : String, age : Int, + address : { calle : String, pais : String } } + +yo : Person +yo = { name = "Guillermo", age = 23, + address = { calle = "Arroyo Fontarrón", pais = "España" } } + +tu : Person +tu = { name = "Paco", age = 15, + address = { calle = "Por allí", pais = "Congo" } } + +persons = [yo, tu] + +olderThan16 = filter ((>) 16 . .age) + +olderThan16_safe = filter (\p -> case p.age of + Nothing -> False + Just age -> age > 16)
\ No newline at end of file |