-
Notifications
You must be signed in to change notification settings - Fork 1
haskell
Evan Moran edited this page May 6, 2015
·
2 revisions
-- comment
: prepend to a list (also known as cons)
'a':[] --> ['a']
'a':[] --> ['a']
++ concatinate lists
"hello" ++ "World --> "Hello World"
[1,2,3] ++ [4] --> [1,2,3,4]
. compose two functions
f(g(x)) == (f . g)(x)
let third = (head . tail . tail)
third [1,2,3] --> 3
>> reverse compose two functions (more readable)
let (>>) f g x = g (f x)
let third = tail >> tail >> head
third [1,2,3] --> 3
$ add
let (|>) x f = f x
!! means access element in list
(['a','b'] !! 0) == 'a'