1 :l myfunctions <span class="co1">--load the functions in the file myfunctions.hs</span>
2 :r <span class="co1">--reload</span>
4 <span class="nu0">1</span> <span class="sy0">/=</span> <span class="nu0">0</span> <span class="co1">--not equal</span>
5 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:succ"><span class="kw3">succ</span></a> <span class="nu0">0</span> <span class="sy0">==</span> <span class="nu0">1</span> <span class="co1">--successor</span>
6 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:min"><span class="kw3">min</span></a> <span class="nu0">1</span> <span class="nu0">2</span> <span class="sy0">==</span> <span class="nu0">1</span> <span class="co1">--minimum</span>
7 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:max"><span class="kw3">max</span></a> <span class="nu0">1</span> <span class="nu0">2</span> <span class="sy0">==</span> <span class="nu0">2</span> <span class="co1">--maximum</span>
8 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:div"><span class="kw3">div</span></a> 2 1 <span class="sy0">==</span> 2 '<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:div"><span class="kw3">div</span></a>' <span class="nu0">1</span> <span class="co1">--infix notation</span>
9 mysucc x <span class="sy0">=</span> x <span class="sy0">+</span> <span class="nu0">1</span> <span class="co1">--function definition</span>
11 <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">2</span><span class="br0">]</span> <span class="sy0">==</span> <span class="nu0">1</span>:<span class="nu0">2</span>:<span class="br0">[</span><span class="br0">]</span> <span class="co1">--list definition</span>
12 <span class="st0">"ab"</span> <span class="sy0">==</span> <span class="br0">[</span>'a'<span class="sy0">,</span> 'b'<span class="br0">]</span> <span class="co1">--string is [Char]</span>
13 <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">2</span><span class="br0">]</span> <span class="sy0">++</span> <span class="br0">[</span><span class="nu0">3</span><span class="sy0">,</span> <span class="nu0">4</span><span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">3</span><span class="sy0">,</span> <span class="nu0">4</span><span class="br0">]</span> <span class="co1">--list concatenation</span>
14 <span class="br0">[</span>'a'<span class="sy0">,</span> 'b'<span class="br0">]</span> <span class="sy0">!!</span> <span class="nu0">1</span> <span class="sy0">==</span> 'b' <span class="co1">--list indexing</span>
16 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"><span class="kw3">head</span></a> <span class="br0">[</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="br0">]</span> <span class="sy0">==</span> 1
17 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:tail"><span class="kw3">tail</span></a> <span class="br0">[</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span>2<span class="sy0">,</span> 3<span class="br0">]</span>
18 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:init"><span class="kw3">init</span></a> <span class="br0">[</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span>1<span class="sy0">,</span> 2<span class="br0">]</span>
19 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:last"><span class="kw3">last</span></a> <span class="br0">[</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="br0">]</span> <span class="sy0">==</span> 3
20 l <span class="sy0">==</span> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"><span class="kw3">head</span></a> l<span class="br0">)</span>:<span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:tail"><span class="kw3">tail</span></a> l<span class="br0">)</span> <span class="sy0">==</span> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:init"><span class="kw3">init</span></a> l<span class="br0">)</span> <span class="sy0">++</span> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:last"><span class="kw3">last</span></a> l<span class="br0">)</span>
22 lenght <span class="br0">[</span>'a'<span class="sy0">,</span> 'b'<span class="br0">]</span> <span class="sy0">==</span> 2
23 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:null"><span class="kw3">null</span></a> <span class="br0">[</span><span class="br0">]</span> <span class="sy0">==</span> True <span class="co1">--list is empty?</span>
24 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:reverse"><span class="kw3">reverse</span></a> <span class="br0">[</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span>3<span class="sy0">,</span> 2<span class="sy0">,</span> 1<span class="br0">]</span>
25 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:take"><span class="kw3">take</span></a> <span class="nu0">2</span> <span class="br0">[</span>'a'<span class="sy0">,</span> 'b'<span class="sy0">,</span> 'c'<span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span>'a'<span class="sy0">,</span> 'b'<span class="br0">]</span> <span class="co1">--first n elements of list</span>
26 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:drop"><span class="kw3">drop</span></a> <span class="nu0">2</span> <span class="br0">[</span>'a'<span class="sy0">,</span> 'b'<span class="sy0">,</span> 'c'<span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span>'c'<span class="br0">]</span> <span class="co1">--drops n elements of list</span>
27 l <span class="sy0">==</span> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:take"><span class="kw3">take</span></a> n l<span class="br0">)</span> <span class="sy0">++</span> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:drop"><span class="kw3">drop</span></a> n l<span class="br0">)</span>
29 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:maximum"><span class="kw3">maximum</span></a> <span class="br0">[</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="br0">]</span> <span class="sy0">==</span> 3
30 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:minimum"><span class="kw3">minimum</span></a> <span class="br0">[</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="br0">]</span> <span class="sy0">==</span> 1
31 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:sum"><span class="kw3">sum</span></a> <span class="br0">[</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="sy0">,</span> 4<span class="br0">]</span> <span class="sy0">==</span> 10
32 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:product"><span class="kw3">product</span></a> <span class="br0">[</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="sy0">,</span> 4<span class="br0">]</span> <span class="sy0">==</span> 24
33 2 '<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:elem"><span class="kw3">elem</span></a>' <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">3</span><span class="br0">]</span> <span class="sy0">==</span> True <span class="co1">--element of the list?</span>
35 <span class="br0">[</span>1<span class="sy0">..</span>3<span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">3</span><span class="br0">]</span>
36 <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span> 3<span class="sy0">..</span>10<span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">3</span><span class="sy0">,</span> <span class="nu0">5</span><span class="sy0">,</span> <span class="nu0">7</span><span class="sy0">,</span> <span class="nu0">9</span><span class="br0">]</span>
37 <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span> 3<span class="sy0">..</span><span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">3</span><span class="sy0">,</span> 5<span class="sy0">..</span><span class="br0">]</span> <span class="co1">--infinite list</span>
38 factorial n <span class="sy0">=</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:product"><span class="kw3">product</span></a> <span class="br0">[</span>1<span class="sy0">..</span>n<span class="br0">]</span>
40 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:take"><span class="kw3">take</span></a> <span class="nu0">24</span> <span class="br0">[</span><span class="nu0">13</span><span class="sy0">,</span> 26<span class="sy0">..</span><span class="br0">]</span> <span class="co1">--the first 24 multiples of 13</span>
41 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:take"><span class="kw3">take</span></a> 7 <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:cycle"><span class="kw3">cycle</span></a> <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">3</span><span class="br0">]</span><span class="br0">)</span> <span class="sy0">==</span> <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">3</span><span class="sy0">,</span> <span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">3</span><span class="sy0">,</span> <span class="nu0">1</span><span class="br0">]</span> <span class="co1">--cycle creates an infinite list</span>
42 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:take"><span class="kw3">take</span></a> 3 <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:repeat"><span class="kw3">repeat</span></a> 'a'<span class="br0">)</span> <span class="sy0">==</span> <span class="br0">[</span>'a'<span class="sy0">,</span> 'a'<span class="sy0">,</span> 'a'<span class="br0">]</span> <span class="co1">--repeat creates an infinite list</span>
43 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:take"><span class="kw3">take</span></a> n <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:repeat"><span class="kw3">repeat</span></a> x<span class="br0">)</span> <span class="sy0">==</span> replicate n x
45 <span class="br0">[</span>x <span class="sy0">*</span> 2 <span class="sy0">|</span> x <span class="sy0"><-</span> <span class="br0">[</span>1 <span class="sy0">..</span> 10<span class="br0">]</span><span class="sy0">,</span> 3 <span class="sy0">*</span> x <span class="sy0"><</span> 7<span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span>2<span class="sy0">,</span> 4<span class="br0">]</span>
46 <span class="br0">[</span> x<span class="sy0">*</span>y <span class="sy0">|</span> x <span class="sy0"><-</span> <span class="br0">[</span>2<span class="sy0">,</span>5<span class="sy0">,</span>10<span class="br0">]</span><span class="sy0">,</span> y <span class="sy0"><-</span> <span class="br0">[</span>8<span class="sy0">,</span>10<span class="sy0">,</span>11<span class="br0">]</span><span class="sy0">,</span> x<span class="sy0">*</span>y <span class="sy0">></span> 50<span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span>55<span class="sy0">,</span>80<span class="sy0">,</span>100<span class="sy0">,</span>110<span class="br0">]</span>
48 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:length"><span class="kw3">length</span></a>' xs <span class="sy0">=</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:sum"><span class="kw3">sum</span></a> <span class="br0">[</span>1 <span class="sy0">|</span> <span class="sy0">_</span> <span class="sy0"><-</span> xs<span class="br0">]</span>
49 removeNonUppercase st <span class="sy0">=</span> <span class="br0">[</span> c <span class="sy0">|</span> c <span class="sy0"><-</span> st<span class="sy0">,</span> c `<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:elem"><span class="kw3">elem</span></a>` <span class="br0">[</span>'A'<span class="sy0">..</span>'Z'<span class="br0">]</span><span class="br0">]</span>
51 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:fst"><span class="kw3">fst</span></a> <span class="br0">(</span>1<span class="sy0">,</span> 'a'<span class="br0">)</span> <span class="sy0">==</span> 1
52 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:snd"><span class="kw3">snd</span></a> <span class="br0">(</span>1<span class="sy0">,</span> 'a'<span class="br0">)</span> <span class="sy0">==</span> 'a'
53 <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:fst"><span class="kw3">fst</span></a> x<span class="sy0">,</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:snd"><span class="kw3">snd</span></a> x<span class="br0">)</span> <span class="sy0">==</span> x
55 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:zip"><span class="kw3">zip</span></a> <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">2</span><span class="br0">]</span> <span class="br0">[</span>'a'<span class="sy0">,</span> 'b'<span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span><span class="br0">(</span><span class="nu0">1</span><span class="sy0">,</span> 'a'<span class="br0">)</span><span class="sy0">,</span> <span class="br0">(</span><span class="nu0">2</span><span class="sy0">,</span> 'b'<span class="br0">)</span><span class="br0">]</span>
56 :t <span class="st0">"HI"</span> <span class="sy0">==</span> <span class="st0">"HI"</span> <span class="sy0">::</span> <span class="br0">[</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Char"><span class="kw4">Char</span></a><span class="br0">]</span> <span class="co1">--type</span>
57 removeNonUppercase <span class="sy0">::</span> <span class="br0">[</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Char"><span class="kw4">Char</span></a><span class="br0">]</span> <span class="sy0">-></span> <span class="br0">[</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Char"><span class="kw4">Char</span></a><span class="br0">]</span> <span class="co1">--function type declaration</span>
58 :t <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"><span class="kw3">head</span></a> <span class="sy0">==</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"><span class="kw3">head</span></a> <span class="sy0">::</span> <span class="br0">[</span>a<span class="br0">]</span> <span class="sy0">-></span> a <span class="co1">--type variable "a"</span>
59 :t <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:elem"><span class="kw3">elem</span></a> <span class="sy0">==</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:elem"><span class="kw3">elem</span></a> <span class="sy0">::</span> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Eq"><span class="kw4">Eq</span></a> a<span class="br0">)</span> <span class="sy0">=></span> a <span class="sy0">-></span> <span class="br0">[</span>a<span class="br0">]</span> <span class="sy0">-></span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Bool"><span class="kw4">Bool</span></a> <span class="co1">--type class "Eq"</span>
61 5 `<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:compare"><span class="kw3">compare</span></a>` 3 <span class="sy0">==</span> GT
63 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:show"><span class="kw3">show</span></a> <span class="nu0">5.334</span> <span class="sy0">==</span> <span class="st0">"5.334"</span> <span class="co1">--to string</span>
64 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:read"><span class="kw3">read</span></a> <span class="st0">"[1, 2, 3]"</span> <span class="sy0">==</span> <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">3</span><span class="br0">]</span> <span class="co1">--from string</span>
65 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:read"><span class="kw3">read</span></a> <span class="st0">"5"</span> <span class="sy0">::</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Float"><span class="kw4">Float</span></a> <span class="co1">--type anotation</span>
67 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:minBound"><span class="kw3">minBound</span></a> <span class="sy0">::</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int"><span class="kw4">Int</span></a> <span class="sy0">==</span> <span class="sy0">-</span>2147483648
68 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:maxBound"><span class="kw3">maxBound</span></a> <span class="sy0">::</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int"><span class="kw4">Int</span></a> <span class="sy0">==</span> 2147483647
69 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:fromIntegral"><span class="kw3">fromIntegral</span></a> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:length"><span class="kw3">length</span></a> <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span><span class="nu0">2</span><span class="sy0">,</span><span class="nu0">3</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">]</span><span class="br0">)</span> <span class="sy0">+</span> <span class="nu0">3.2</span> <span class="sy0">==</span> <span class="nu0">7.2</span> <span class="co1">--integral to float</span>
71 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"><span class="kw3">head</span></a>' <span class="sy0">::</span> <span class="br0">[</span>a<span class="br0">]</span> <span class="sy0">-></span> a
72 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"><span class="kw3">head</span></a>' <span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:error"><span class="kw3">error</span></a> <span class="st0">"Can't call head on an empty list, dummy!"</span> <span class="co1">--run-time error</span>
73 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"><span class="kw3">head</span></a>' <span class="br0">(</span>x:<span class="sy0">_</span><span class="br0">)</span> <span class="sy0">=</span> x
75 capital <span class="sy0">::</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:String"><span class="kw4">String</span></a> <span class="sy0">-></span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:String"><span class="kw4">String</span></a>
76 capital <span class="st0">""</span> <span class="sy0">=</span> <span class="st0">"Empty string, whoops!"</span>
77 capital <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:all"><span class="kw3">all</span></a><span class="sy0">@</span><span class="br0">(</span>x:xs<span class="br0">)</span> <span class="sy0">=</span> <span class="st0">"The first letter of "</span> <span class="sy0">++</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:all"><span class="kw3">all</span></a> <span class="sy0">++</span> <span class="st0">" is "</span> <span class="sy0">++</span> <span class="br0">[</span>x<span class="br0">]</span> <span class="co1">--as pattern</span>
79 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:max"><span class="kw3">max</span></a>' <span class="sy0">::</span> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Ord"><span class="kw4">Ord</span></a> a<span class="br0">)</span> <span class="sy0">=></span> a <span class="sy0">-></span> a <span class="sy0">-></span> a
80 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:max"><span class="kw3">max</span></a>' a b
81 <span class="sy0">|</span> a <span class="sy0">></span> b <span class="sy0">=</span> a <span class="co1">--guard</span>
82 <span class="sy0">|</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:otherwise"><span class="kw3">otherwise</span></a> <span class="sy0">=</span> b <span class="co1">--otherwise = True</span>
84 bmiTell <span class="sy0">::</span> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:RealFloat"><span class="kw4">RealFloat</span></a> a<span class="br0">)</span> <span class="sy0">=></span> a <span class="sy0">-></span> a <span class="sy0">-></span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:String"><span class="kw4">String</span></a>
86 <span class="sy0">|</span> bmi <span class="sy0"><=</span> skinny <span class="sy0">=</span> <span class="st0">"You're underweight, you emo, you!"</span>
87 <span class="sy0">|</span> bmi <span class="sy0"><=</span> normal <span class="sy0">=</span> <span class="st0">"You're supposedly normal. Pffft, I bet you're ugly!"</span>
88 <span class="sy0">|</span> bmi <span class="sy0"><=</span> fat <span class="sy0">=</span> <span class="st0">"You're fat! Lose some weight, fatty!"</span>
89 <span class="sy0">|</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:otherwise"><span class="kw3">otherwise</span></a> <span class="sy0">=</span> <span class="st0">"You're a whale, congratulations!"</span>
90 <span class="kw1">where</span> bmi <span class="sy0">=</span> weight <span class="sy0">/</span> height <span class="sy0">^</span> 2
91 <span class="br0">(</span>skinny<span class="sy0">,</span> normal<span class="sy0">,</span> fat<span class="br0">)</span> <span class="sy0">=</span> <span class="br0">(</span>18<span class="sy0">.</span>5<span class="sy0">,</span> 25<span class="sy0">.</span>0<span class="sy0">,</span> 30<span class="sy0">.</span>0<span class="br0">)</span>
93 cylinderSurfaceArea <span class="sy0">::</span> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:RealFloat"><span class="kw4">RealFloat</span></a> a<span class="br0">)</span> <span class="sy0">=></span> a <span class="sy0">-></span> a <span class="sy0">-></span> a
94 cylinderSurfaceArea r h <span class="sy0">=</span>
95 <span class="kw1">let</span> sideArea <span class="sy0">=</span> 2 <span class="sy0">*</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:pi"><span class="kw3">pi</span></a> <span class="sy0">*</span> r <span class="sy0">*</span> h
96 topArea <span class="sy0">=</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:pi"><span class="kw3">pi</span></a> <span class="sy0">*</span> r <span class="sy0">^</span> 2
97 <span class="kw1">in</span> sideArea <span class="sy0">+</span> 2 <span class="sy0">*</span> topArea
99 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"><span class="kw3">head</span></a>' <span class="sy0">::</span> <span class="br0">[</span>a<span class="br0">]</span> <span class="sy0">-></span> a
100 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"><span class="kw3">head</span></a>' xs <span class="sy0">=</span> <span class="kw1">case</span> xs <span class="kw1">of</span> <span class="br0">[</span><span class="br0">]</span> <span class="sy0">-></span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:error"><span class="kw3">error</span></a> <span class="st0">"No head for empty lists!"</span>
101 <span class="br0">(</span>x:<span class="sy0">_</span><span class="br0">)</span> <span class="sy0">-></span> x
103 quicksort <span class="sy0">::</span> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Ord"><span class="kw4">Ord</span></a> a<span class="br0">)</span> <span class="sy0">=></span> <span class="br0">[</span>a<span class="br0">]</span> <span class="sy0">-></span> <span class="br0">[</span>a<span class="br0">]</span>
104 quicksort <span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <span class="br0">[</span><span class="br0">]</span>
105 quicksort <span class="br0">(</span>x:xs<span class="br0">)</span> <span class="sy0">=</span>
106 <span class="kw1">let</span> smallerSorted <span class="sy0">=</span> quicksort <span class="br0">[</span>a <span class="sy0">|</span> a <span class="sy0"><-</span> xs<span class="sy0">,</span> a <span class="sy0"><=</span> x<span class="br0">]</span>
107 biggerSorted <span class="sy0">=</span> quicksort <span class="br0">[</span>a <span class="sy0">|</span> a <span class="sy0"><-</span> xs<span class="sy0">,</span> a <span class="sy0">></span> x<span class="br0">]</span>
108 <span class="kw1">in</span> smallerSorted <span class="sy0">++</span> <span class="br0">[</span>x<span class="br0">]</span> <span class="sy0">++</span> biggerSorted
110 divideByTen <span class="sy0">::</span> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Floating"><span class="kw4">Floating</span></a> a<span class="br0">)</span> <span class="sy0">=></span> a <span class="sy0">-></span> a
111 divideByTen <span class="sy0">=</span> <span class="br0">(</span><span class="sy0">/</span><span class="nu0">10</span><span class="br0">)</span> <span class="co1">--section, infix function partial application</span>
113 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:zipWith"><span class="kw3">zipWith</span></a>' <span class="sy0">::</span> <span class="br0">(</span>a <span class="sy0">-></span> b <span class="sy0">-></span> c<span class="br0">)</span> <span class="sy0">-></span> <span class="br0">[</span>a<span class="br0">]</span> <span class="sy0">-></span> <span class="br0">[</span>b<span class="br0">]</span> <span class="sy0">-></span> <span class="br0">[</span>c<span class="br0">]</span>
114 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:zipWith"><span class="kw3">zipWith</span></a>' <span class="sy0">_</span> <span class="br0">[</span><span class="br0">]</span> <span class="sy0">_</span> <span class="sy0">=</span> <span class="br0">[</span><span class="br0">]</span>
115 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:zipWith"><span class="kw3">zipWith</span></a>' <span class="sy0">_</span> <span class="sy0">_</span> <span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <span class="br0">[</span><span class="br0">]</span>
116 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:zipWith"><span class="kw3">zipWith</span></a>' f <span class="br0">(</span>x:xs<span class="br0">)</span> <span class="br0">(</span>y:ys<span class="br0">)</span> <span class="sy0">=</span> f x y : <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:zipWith"><span class="kw3">zipWith</span></a>' f xs ys
118 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"><span class="kw3">map</span></a> <span class="sy0">::</span> <span class="br0">(</span>a <span class="sy0">-></span> b<span class="br0">)</span> <span class="sy0">-></span> <span class="br0">[</span>a<span class="br0">]</span> <span class="sy0">-></span> <span class="br0">[</span>b<span class="br0">]</span>
119 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"><span class="kw3">map</span></a> <span class="sy0">_</span> <span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <span class="br0">[</span><span class="br0">]</span>
120 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"><span class="kw3">map</span></a> f <span class="br0">(</span>x:xs<span class="br0">)</span> <span class="sy0">=</span> f x : <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"><span class="kw3">map</span></a> f xs
122 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:filter"><span class="kw3">filter</span></a> <span class="sy0">::</span> <span class="br0">(</span>a <span class="sy0">-></span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Bool"><span class="kw4">Bool</span></a><span class="br0">)</span> <span class="sy0">-></span> <span class="br0">[</span>a<span class="br0">]</span> <span class="sy0">-></span> <span class="br0">[</span>a<span class="br0">]</span>
123 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:filter"><span class="kw3">filter</span></a> <span class="sy0">_</span> <span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <span class="br0">[</span><span class="br0">]</span>
124 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:filter"><span class="kw3">filter</span></a> p <span class="br0">(</span>x:xs<span class="br0">)</span>
125 <span class="sy0">|</span> p x <span class="sy0">=</span> x : <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:filter"><span class="kw3">filter</span></a> p xs
126 <span class="sy0">|</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:otherwise"><span class="kw3">otherwise</span></a> <span class="sy0">=</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:filter"><span class="kw3">filter</span></a> p xs
127 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:filter"><span class="kw3">filter</span></a> p l <span class="sy0">==</span> <span class="br0">[</span>x <span class="sy0">|</span> x <span class="sy0"><-</span> l<span class="sy0">,</span> p x<span class="br0">]</span>
129 quicksort <span class="sy0">::</span> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Ord"><span class="kw4">Ord</span></a> a<span class="br0">)</span> <span class="sy0">=></span> <span class="br0">[</span>a<span class="br0">]</span> <span class="sy0">-></span> <span class="br0">[</span>a<span class="br0">]</span>
130 quicksort <span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <span class="br0">[</span><span class="br0">]</span>
131 quicksort <span class="br0">(</span>x:xs<span class="br0">)</span> <span class="sy0">=</span>
132 <span class="kw1">let</span> smallerSorted <span class="sy0">=</span> quicksort <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:filter"><span class="kw3">filter</span></a> <span class="br0">(</span><span class="sy0"><=</span>x<span class="br0">)</span> xs<span class="br0">)</span>
133 biggerSorted <span class="sy0">=</span> quicksort <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:filter"><span class="kw3">filter</span></a> <span class="br0">(</span><span class="sy0">></span>x<span class="br0">)</span> xs<span class="br0">)</span>
134 <span class="kw1">in</span> smallerSorted <span class="sy0">++</span> <span class="br0">[</span>x<span class="br0">]</span> <span class="sy0">++</span> biggerSorted
136 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:sum"><span class="kw3">sum</span></a> <span class="br0">(</span>takeWhile <span class="br0">(</span><span class="sy0"><</span>10000<span class="br0">)</span> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:filter"><span class="kw3">filter</span></a> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:odd"><span class="kw3">odd</span></a> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"><span class="kw3">map</span></a> <span class="br0">(</span><span class="sy0">^</span><span class="nu0">2</span><span class="br0">)</span> <span class="br0">[</span>1<span class="sy0">..</span><span class="br0">]</span><span class="br0">)</span><span class="br0">)</span><span class="br0">)</span> <span class="co1">--sum of all odd squares that are smaller than 10,000</span>
138 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:zipWith"><span class="kw3">zipWith</span></a> <span class="br0">(</span><span class="sy0">+</span><span class="br0">)</span> l r <span class="sy0">==</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:zipWith"><span class="kw3">zipWith</span></a> <span class="br0">(</span>\a b <span class="sy0">-></span> a <span class="sy0">+</span> b<span class="br0">)</span> l r <span class="co1">--lamba function</span>
140 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:sum"><span class="kw3">sum</span></a>' <span class="sy0">::</span> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Num"><span class="kw4">Num</span></a> a<span class="br0">)</span> <span class="sy0">=></span> <span class="br0">[</span>a<span class="br0">]</span> <span class="sy0">-></span> a
141 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:sum"><span class="kw3">sum</span></a>' xs <span class="sy0">=</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:foldl"><span class="kw3">foldl</span></a> <span class="br0">(</span>\acc x <span class="sy0">-></span> acc <span class="sy0">+</span> x<span class="br0">)</span> 0 xs
142 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:sum"><span class="kw3">sum</span></a> <span class="sy0">==</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:foldl"><span class="kw3">foldl</span></a> <span class="br0">(</span><span class="sy0">+</span><span class="br0">)</span> 0
144 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:elem"><span class="kw3">elem</span></a>' y ys <span class="sy0">=</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:foldl"><span class="kw3">foldl</span></a> <span class="br0">(</span>\acc x <span class="sy0">-></span> acc <span class="sy0">||</span> x <span class="sy0">==</span> y<span class="br0">)</span> False ys
146 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"><span class="kw3">map</span></a>' <span class="sy0">::</span> <span class="br0">(</span>a <span class="sy0">-></span> b<span class="br0">)</span> <span class="sy0">-></span> <span class="br0">[</span>a<span class="br0">]</span> <span class="sy0">-></span> <span class="br0">[</span>b<span class="br0">]</span>
147 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"><span class="kw3">map</span></a>' f xs <span class="sy0">=</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:foldr"><span class="kw3">foldr</span></a> <span class="br0">(</span>\x acc <span class="sy0">-></span> f x : acc<span class="br0">)</span> <span class="br0">[</span><span class="br0">]</span> xs
149 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:filter"><span class="kw3">filter</span></a>' <span class="sy0">::</span> <span class="br0">(</span>a <span class="sy0">-></span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Bool"><span class="kw4">Bool</span></a><span class="br0">)</span> <span class="sy0">-></span> <span class="br0">[</span>a<span class="br0">]</span> <span class="sy0">-></span> <span class="br0">[</span>a<span class="br0">]</span>
150 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:filter"><span class="kw3">filter</span></a>' p <span class="sy0">=</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:foldr"><span class="kw3">foldr</span></a> <span class="br0">(</span>\x acc <span class="sy0">-></span> <span class="kw1">if</span> p x <span class="kw1">then</span> x : acc <span class="kw1">else</span> acc<span class="br0">)</span> <span class="br0">[</span><span class="br0">]</span>
152 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:scanl"><span class="kw3">scanl</span></a> <span class="br0">(</span><span class="sy0">+</span><span class="br0">)</span> <span class="nu0">0</span> <span class="br0">[</span><span class="nu0">3</span><span class="sy0">,</span><span class="nu0">5</span><span class="sy0">,</span><span class="nu0">2</span><span class="sy0">,</span><span class="nu0">1</span><span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">3</span><span class="sy0">,</span><span class="nu0">8</span><span class="sy0">,</span><span class="nu0">10</span><span class="sy0">,</span><span class="nu0">11</span><span class="br0">]</span> <span class="co1">--fold that keeps partial results</span>
154 <span class="br0">(</span><span class="sy0">$</span><span class="br0">)</span> <span class="sy0">::</span> <span class="br0">(</span>a <span class="sy0">-></span> b<span class="br0">)</span> <span class="sy0">-></span> a <span class="sy0">-></span> b
155 f <span class="sy0">$</span> x <span class="sy0">=</span> f x <span class="co1">--function application function</span>
156 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"><span class="kw3">map</span></a> <span class="br0">(</span><span class="sy0">$</span> <span class="nu0">3</span><span class="br0">)</span> <span class="br0">[</span><span class="br0">(</span><span class="nu0">4</span><span class="sy0">+</span><span class="br0">)</span><span class="sy0">,</span> <span class="br0">(</span><span class="nu0">10</span><span class="sy0">*</span><span class="br0">)</span><span class="sy0">,</span> <span class="br0">(</span><span class="sy0">^</span><span class="nu0">2</span><span class="br0">)</span><span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span><span class="nu0">7</span><span class="sy0">,</span> <span class="nu0">30</span><span class="sy0">,</span> <span class="nu0">9</span><span class="br0">]</span> <span class="co1">--mapping function application</span>
158 <span class="br0">(</span><span class="sy0">.</span><span class="br0">)</span> <span class="sy0">::</span> <span class="br0">(</span>b <span class="sy0">-></span> c<span class="br0">)</span> <span class="sy0">-></span> <span class="br0">(</span>a <span class="sy0">-></span> b<span class="br0">)</span> <span class="sy0">-></span> a <span class="sy0">-></span> c
159 f <span class="sy0">.</span> g <span class="sy0">=</span> \x <span class="sy0">-></span> f <span class="br0">(</span>g x<span class="br0">)</span> <span class="co1">--function composition function</span>
161 <span class="kw1">import</span> Data<span class="sy0">.</span>List <span class="co1">--import Data.List module</span>
162 :m <span class="sy0">+</span> Data<span class="sy0">.</span>List Data<span class="sy0">.</span>Map Data<span class="sy0">.</span>Set <span class="co1">--import several modules</span>
163 <span class="kw1">import</span> Data<span class="sy0">.</span>List <span class="br0">(</span>nub<span class="sy0">,</span> sort<span class="br0">)</span> <span class="co1">--import just nub and sort</span>
164 <span class="kw1">import</span> Data<span class="sy0">.</span>List <span class="kw1">hiding</span> <span class="br0">(</span>nub<span class="br0">)</span> <span class="co1">--import all except nub</span>
165 <span class="kw1">import</span> <span class="kw1">qualified</span> Data<span class="sy0">.</span>Map <span class="co1">--force qualification</span>
166 <span class="kw1">import</span> <span class="kw1">qualified</span> Data<span class="sy0">.</span>Map <span class="kw1">as</span> M <span class="co1">--force and rename qualification</span>
168 <span class="coMULTI">{-
173 intersperse <span class="nu0">0</span> <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">3</span><span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">3</span><span class="br0">]</span>
174 intercalate <span class="st0">" - "</span> <span class="br0">[</span><span class="st0">"hey"</span><span class="sy0">,</span><span class="st0">"there"</span><span class="sy0">,</span><span class="st0">"guys"</span><span class="br0">]</span> <span class="sy0">==</span> <span class="st0">"hey - there - guys"</span>
175 transpose <span class="br0">[</span><span class="br0">[</span>1<span class="sy0">,</span>2<span class="sy0">,</span>3<span class="br0">]</span><span class="sy0">,</span><span class="br0">[</span>4<span class="sy0">,</span>5<span class="sy0">,</span>6<span class="br0">]</span><span class="sy0">,</span><span class="br0">[</span>7<span class="sy0">,</span>8<span class="sy0">,</span>9<span class="br0">]</span><span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span><span class="br0">[</span>1<span class="sy0">,</span>4<span class="sy0">,</span>7<span class="br0">]</span><span class="sy0">,</span><span class="br0">[</span>2<span class="sy0">,</span>5<span class="sy0">,</span>8<span class="br0">]</span><span class="sy0">,</span><span class="br0">[</span>3<span class="sy0">,</span>6<span class="sy0">,</span>9<span class="br0">]</span><span class="br0">]</span>
176 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:concat"><span class="kw3">concat</span></a> <span class="br0">[</span>1<span class="sy0">,</span> 2<span class="br0">]</span> <span class="br0">[</span>3<span class="sy0">,</span> 4<span class="sy0">,</span> 5<span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="sy0">,</span> 4<span class="sy0">,</span> 5<span class="br0">]</span>
177 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:concatMap"><span class="kw3">concatMap</span></a>' f <span class="sy0">=</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:concat"><span class="kw3">concat</span></a> <span class="sy0">.</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"><span class="kw3">map</span></a> f
179 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:and"><span class="kw3">and</span></a> <span class="sy0">$</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"><span class="kw3">map</span></a> <span class="br0">(</span><span class="sy0">></span>4<span class="br0">)</span> <span class="br0">[</span>5<span class="sy0">,</span>6<span class="sy0">,</span>7<span class="sy0">,</span>8<span class="br0">]</span> <span class="sy0">==</span> True
180 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:or"><span class="kw3">or</span></a> <span class="sy0">$</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"><span class="kw3">map</span></a> <span class="br0">(</span><span class="sy0">></span>4<span class="br0">)</span> <span class="br0">[</span>1<span class="sy0">,</span>2<span class="sy0">,</span>3<span class="br0">]</span> <span class="sy0">==</span> False
181 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:any"><span class="kw3">any</span></a> <span class="br0">(</span><span class="sy0">==</span>4<span class="br0">)</span> <span class="br0">[</span>2<span class="sy0">,</span>3<span class="sy0">,</span>5<span class="sy0">,</span>6<span class="sy0">,</span>1<span class="sy0">,</span>4<span class="br0">]</span> <span class="sy0">==</span> True
182 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:all"><span class="kw3">all</span></a> <span class="br0">(</span><span class="sy0">==</span>4<span class="br0">)</span> <span class="br0">[</span>2<span class="sy0">,</span>3<span class="sy0">,</span>5<span class="sy0">,</span>6<span class="sy0">,</span>1<span class="sy0">,</span>4<span class="br0">]</span> <span class="sy0">==</span> False
184 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:take"><span class="kw3">take</span></a> 4 <span class="sy0">$</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:iterate"><span class="kw3">iterate</span></a> <span class="br0">(</span><span class="sy0">*</span>2<span class="br0">)</span> 1 <span class="sy0">==</span> <span class="br0">[</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 4<span class="sy0">,</span> 8<span class="br0">]</span>
185 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:splitAt"><span class="kw3">splitAt</span></a> <span class="nu0">3</span> <span class="st0">"abcd"</span> <span class="sy0">==</span> <span class="br0">(</span><span class="st0">"abc"</span><span class="sy0">,</span><span class="st0">"d"</span><span class="br0">)</span>
186 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:dropWhile"><span class="kw3">dropWhile</span></a> <span class="br0">(</span><span class="sy0"><</span>3<span class="br0">)</span> <span class="br0">[</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="sy0">,</span> 4<span class="br0">]</span> <span class="sy0">==</span> <span class="br0">[</span>3<span class="sy0">,</span> 4<span class="br0">]</span>
187 <span class="br0">(</span>takeWhile p l<span class="br0">)</span> <span class="sy0">++</span> <span class="br0">(</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:dropWhile"><span class="kw3">dropWhile</span></a> p l<span class="br0">)</span> <span class="sy0">==</span> l
188 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:span"><span class="kw3">span</span></a> p l <span class="sy0">==</span> <span class="br0">(</span>takeWhile p l<span class="sy0">,</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:dropWhile"><span class="kw3">dropWhile</span></a> p l<span class="br0">)</span>
189 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:break"><span class="kw3">break</span></a> p <span class="sy0">==</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:span"><span class="kw3">span</span></a> <span class="sy0">$</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:not"><span class="kw3">not</span></a> <span class="sy0">.</span> p