backup de julho
[h2N7SspZmY.git] / data / cache / 4 / 4ca52c1c06355fcef849df5c3a3375cd.code
blob179b1434775cb7445afec135cac296cb4f31b22e
1 :l myfunctions <span class="co1">--load the functions in the file myfunctions.hs</span>
2 :r             <span class="co1">--reload</span>
3 &nbsp;
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>
10 &nbsp;
11 <span class="br0">&#91;</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">2</span><span class="br0">&#93;</span> <span class="sy0">==</span> <span class="nu0">1</span>:<span class="nu0">2</span>:<span class="br0">&#91;</span><span class="br0">&#93;</span>     <span class="co1">--list definition</span>
12 <span class="br0">&#91;</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">2</span><span class="br0">&#93;</span> <span class="sy0">++</span> <span class="br0">&#91;</span><span class="nu0">3</span><span class="sy0">,</span> <span class="nu0">4</span><span class="br0">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</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">&#93;</span> <span class="co1">--list concatenation</span>
13 <span class="br0">&#91;</span>'a'<span class="sy0">,</span> 'b'<span class="br0">&#93;</span> <span class="sy0">!!</span> <span class="nu0">1</span> <span class="sy0">==</span> 'b'           <span class="co1">--list indexing</span>
14 &nbsp;
15 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"><span class="kw3">head</span></a> <span class="br0">&#91;</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="br0">&#93;</span> <span class="sy0">==</span> 1
16 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:tail"><span class="kw3">tail</span></a> <span class="br0">&#91;</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="br0">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</span>2<span class="sy0">,</span> 3<span class="br0">&#93;</span>
17 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:init"><span class="kw3">init</span></a> <span class="br0">&#91;</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="br0">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</span>1<span class="sy0">,</span> 2<span class="br0">&#93;</span>
18 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:last"><span class="kw3">last</span></a> <span class="br0">&#91;</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="br0">&#93;</span> <span class="sy0">==</span> 3
19 l <span class="sy0">==</span> <span class="br0">&#40;</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">&#41;</span>:<span class="br0">&#40;</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">&#41;</span> <span class="sy0">==</span> <span class="br0">&#40;</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">&#41;</span> <span class="sy0">++</span> <span class="br0">&#40;</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">&#41;</span>
20 &nbsp;
21 lenght <span class="br0">&#91;</span>'a'<span class="sy0">,</span> 'b'<span class="br0">&#93;</span> <span class="sy0">==</span> 2
22 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:null"><span class="kw3">null</span></a> <span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">==</span> True                  <span class="co1">--list is empty?</span>
23 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:reverse"><span class="kw3">reverse</span></a> <span class="br0">&#91;</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="br0">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</span>3<span class="sy0">,</span> 2<span class="sy0">,</span> 1<span class="br0">&#93;</span>
24 <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">&#91;</span>'a'<span class="sy0">,</span> 'b'<span class="sy0">,</span> 'c'<span class="br0">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</span>'a'<span class="sy0">,</span> 'b'<span class="br0">&#93;</span> <span class="co1">--first n elements of list</span>
25 <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">&#91;</span>'a'<span class="sy0">,</span> 'b'<span class="sy0">,</span> 'c'<span class="br0">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</span>'c'<span class="br0">&#93;</span>      <span class="co1">--drops n elements of list</span>
26 l <span class="sy0">==</span> <span class="br0">&#40;</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">&#41;</span> <span class="sy0">++</span> <span class="br0">&#40;</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">&#41;</span>
27 &nbsp;
28 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:maximum"><span class="kw3">maximum</span></a> <span class="br0">&#91;</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="br0">&#93;</span> <span class="sy0">==</span> 3
29 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:minimum"><span class="kw3">minimum</span></a> <span class="br0">&#91;</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="br0">&#93;</span> <span class="sy0">==</span> 1
30 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:sum"><span class="kw3">sum</span></a> <span class="br0">&#91;</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="sy0">,</span> 4<span class="br0">&#93;</span> <span class="sy0">==</span> 10
31 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:product"><span class="kw3">product</span></a> <span class="br0">&#91;</span>1<span class="sy0">,</span> 2<span class="sy0">,</span> 3<span class="sy0">,</span> 4<span class="br0">&#93;</span> <span class="sy0">==</span> 24
32 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">&#91;</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">&#93;</span> <span class="sy0">==</span> True       <span class="co1">--element of the list?</span>
33 &nbsp;
34 <span class="br0">&#91;</span>1<span class="sy0">..</span>3<span class="br0">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</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">&#93;</span>
35 <span class="br0">&#91;</span><span class="nu0">1</span><span class="sy0">,</span> 3<span class="sy0">..</span>10<span class="br0">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</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">&#93;</span>
36 <span class="br0">&#91;</span><span class="nu0">1</span><span class="sy0">,</span> 3<span class="sy0">..</span><span class="br0">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</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">&#93;</span>          <span class="co1">--infinite list</span>
37 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">&#91;</span>1<span class="sy0">..</span>n<span class="br0">&#93;</span>
38 &nbsp;
39 <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">&#91;</span><span class="nu0">13</span><span class="sy0">,</span> 26<span class="sy0">..</span><span class="br0">&#93;</span>               <span class="co1">--the first 24 multiples of 13</span>
40 <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">&#40;</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">&#91;</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">&#93;</span><span class="br0">&#41;</span> <span class="sy0">==</span> <span class="br0">&#91;</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">&#93;</span> <span class="co1">--cycle creates an infinite list</span>
41 <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">&#40;</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">&#41;</span> <span class="sy0">==</span> <span class="br0">&#91;</span>'a'<span class="sy0">,</span> 'a'<span class="sy0">,</span> 'a'<span class="br0">&#93;</span>            <span class="co1">--repeat 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> n <span class="br0">&#40;</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">&#41;</span> <span class="sy0">==</span> replicate n x
43 &nbsp;
44 <span class="br0">&#91;</span>x <span class="sy0">*</span> 2 <span class="sy0">|</span> x <span class="sy0">&lt;-</span> <span class="br0">&#91;</span>1 <span class="sy0">..</span> 10<span class="br0">&#93;</span><span class="sy0">,</span> 3 <span class="sy0">*</span> x <span class="sy0">&lt;</span> 7<span class="br0">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</span>2<span class="sy0">,</span> 4<span class="br0">&#93;</span>
45 <span class="br0">&#91;</span> x<span class="sy0">*</span>y <span class="sy0">|</span> x <span class="sy0">&lt;-</span> <span class="br0">&#91;</span>2<span class="sy0">,</span>5<span class="sy0">,</span>10<span class="br0">&#93;</span><span class="sy0">,</span> y <span class="sy0">&lt;-</span> <span class="br0">&#91;</span>8<span class="sy0">,</span>10<span class="sy0">,</span>11<span class="br0">&#93;</span><span class="sy0">,</span> x<span class="sy0">*</span>y <span class="sy0">&gt;</span> 50<span class="br0">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</span>55<span class="sy0">,</span>80<span class="sy0">,</span>100<span class="sy0">,</span>110<span class="br0">&#93;</span>
46 &nbsp;
47 <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">&#91;</span>1 <span class="sy0">|</span> <span class="sy0">_</span> <span class="sy0">&lt;-</span> xs<span class="br0">&#93;</span>
48 removeNonUppercase st <span class="sy0">=</span> <span class="br0">&#91;</span> c <span class="sy0">|</span> c <span class="sy0">&lt;-</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">&#91;</span>'A'<span class="sy0">..</span>'Z'<span class="br0">&#93;</span><span class="br0">&#93;</span>
49 &nbsp;
50 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:fst"><span class="kw3">fst</span></a> <span class="br0">&#40;</span>1<span class="sy0">,</span> 'a'<span class="br0">&#41;</span> <span class="sy0">==</span> 1
51 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:snd"><span class="kw3">snd</span></a> <span class="br0">&#40;</span>1<span class="sy0">,</span> 'a'<span class="br0">&#41;</span> <span class="sy0">==</span> 'a'
52 <span class="br0">&#40;</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">&#41;</span> <span class="sy0">==</span> x
53 &nbsp;
54 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:zip"><span class="kw3">zip</span></a> <span class="br0">&#91;</span><span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">2</span><span class="br0">&#93;</span> <span class="br0">&#91;</span>'a'<span class="sy0">,</span> 'b'<span class="br0">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</span><span class="br0">&#40;</span><span class="nu0">1</span><span class="sy0">,</span> 'a'<span class="br0">&#41;</span><span class="sy0">,</span> <span class="br0">&#40;</span><span class="nu0">2</span><span class="sy0">,</span> 'b'<span class="br0">&#41;</span><span class="br0">&#93;</span>
55 :t <span class="st0">&quot;HI&quot;</span> <span class="sy0">==</span> <span class="st0">&quot;HI&quot;</span> <span class="sy0">::</span> <span class="br0">&#91;</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">&#93;</span>                         <span class="co1">--type</span>
56 removeNonUppercase <span class="sy0">::</span> <span class="br0">&#91;</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">&#93;</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</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">&#93;</span>            <span class="co1">--function type declaration</span>
57 :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">&#91;</span>a<span class="br0">&#93;</span> <span class="sy0">-&gt;</span> a                       <span class="co1">--type variable &quot;a&quot;</span>
58 :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">&#40;</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">&#41;</span> <span class="sy0">=&gt;</span> a <span class="sy0">-&gt;</span> <span class="br0">&#91;</span>a<span class="br0">&#93;</span> <span class="sy0">-&gt;</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 &quot;Eq&quot;</span>
59 &nbsp;
60 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
61 &nbsp;
62 <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">&quot;5.334&quot;</span>                             <span class="co1">--to string</span>
63 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:read"><span class="kw3">read</span></a> <span class="st0">&quot;[1, 2, 3]&quot;</span> <span class="sy0">==</span> <span class="br0">&#91;</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">&#93;</span>                     <span class="co1">--from 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">&quot;5&quot;</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>
65 &nbsp;
66 <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
67 <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
68 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:fromIntegral"><span class="kw3">fromIntegral</span></a> <span class="br0">&#40;</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">&#91;</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">&#93;</span><span class="br0">&#41;</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>
69 &nbsp;
70 <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">&#91;</span>a<span class="br0">&#93;</span> <span class="sy0">-&gt;</span> a  
71 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"><span class="kw3">head</span></a>' <span class="br0">&#91;</span><span class="br0">&#93;</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">&quot;Can't call head on an empty list, dummy!&quot;</span>  <span class="co1">--run-time error</span>
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">&#40;</span>x:<span class="sy0">_</span><span class="br0">&#41;</span> <span class="sy0">=</span> x  
73 &nbsp;
74 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">-&gt;</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:String"><span class="kw4">String</span></a>  
75 capital <span class="st0">&quot;&quot;</span> <span class="sy0">=</span> <span class="st0">&quot;Empty string, whoops!&quot;</span>  
76 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">&#40;</span>x:xs<span class="br0">&#41;</span> <span class="sy0">=</span> <span class="st0">&quot;The first letter of &quot;</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">&quot; is &quot;</span> <span class="sy0">++</span> <span class="br0">&#91;</span>x<span class="br0">&#93;</span> <span class="co1">--as pattern</span>
77 &nbsp;
78 <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">&#40;</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">&#41;</span> <span class="sy0">=&gt;</span> a <span class="sy0">-&gt;</span> a <span class="sy0">-&gt;</span> a  
79 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:max"><span class="kw3">max</span></a>' a b   
80   <span class="sy0">|</span> a <span class="sy0">&gt;</span> b     <span class="sy0">=</span> a  <span class="co1">--guard</span>
81   <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>
82 &nbsp;
83 bmiTell <span class="sy0">::</span> <span class="br0">&#40;</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">&#41;</span> <span class="sy0">=&gt;</span> a <span class="sy0">-&gt;</span> a <span class="sy0">-&gt;</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:String"><span class="kw4">String</span></a>  
84 bmiTell weight height  
85   <span class="sy0">|</span> bmi <span class="sy0">&lt;=</span> skinny <span class="sy0">=</span> <span class="st0">&quot;You're underweight, you emo, you!&quot;</span>  
86   <span class="sy0">|</span> bmi <span class="sy0">&lt;=</span> normal <span class="sy0">=</span> <span class="st0">&quot;You're supposedly normal. Pffft, I bet you're ugly!&quot;</span>  
87   <span class="sy0">|</span> bmi <span class="sy0">&lt;=</span> fat    <span class="sy0">=</span> <span class="st0">&quot;You're fat! Lose some weight, fatty!&quot;</span>  
88   <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">&quot;You're a whale, congratulations!&quot;</span>
89   <span class="kw1">where</span> bmi <span class="sy0">=</span> weight <span class="sy0">/</span> height <span class="sy0">^</span> 2  
90         <span class="br0">&#40;</span>skinny<span class="sy0">,</span> normal<span class="sy0">,</span> fat<span class="br0">&#41;</span> <span class="sy0">=</span> <span class="br0">&#40;</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">&#41;</span>  
91 &nbsp;
92 cylinderSurfaceArea <span class="sy0">::</span> <span class="br0">&#40;</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">&#41;</span> <span class="sy0">=&gt;</span> a <span class="sy0">-&gt;</span> a <span class="sy0">-&gt;</span> a  
93 cylinderSurfaceArea r h <span class="sy0">=</span> 
94   <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  
95       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  
96   <span class="kw1">in</span>  sideArea <span class="sy0">+</span> 2 <span class="sy0">*</span> topArea   
97 &nbsp;
98 <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">&#91;</span>a<span class="br0">&#93;</span> <span class="sy0">-&gt;</span> a
99 <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">&#91;</span><span class="br0">&#93;</span> <span class="sy0">-&gt;</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">&quot;No head for empty lists!&quot;</span>
100                       <span class="br0">&#40;</span>x:<span class="sy0">_</span><span class="br0">&#41;</span> <span class="sy0">-&gt;</span> x
101 &nbsp;
102 quicksort <span class="sy0">::</span> <span class="br0">&#40;</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">&#41;</span> <span class="sy0">=&gt;</span> <span class="br0">&#91;</span>a<span class="br0">&#93;</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</span>a<span class="br0">&#93;</span>  
103 quicksort <span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#93;</span>  
104 quicksort <span class="br0">&#40;</span>x:xs<span class="br0">&#41;</span> <span class="sy0">=</span>   
105   <span class="kw1">let</span> smallerSorted <span class="sy0">=</span> quicksort <span class="br0">&#91;</span>a <span class="sy0">|</span> a <span class="sy0">&lt;-</span> xs<span class="sy0">,</span> a <span class="sy0">&lt;=</span> x<span class="br0">&#93;</span>  
106       biggerSorted <span class="sy0">=</span> quicksort <span class="br0">&#91;</span>a <span class="sy0">|</span> a <span class="sy0">&lt;-</span> xs<span class="sy0">,</span> a <span class="sy0">&gt;</span> x<span class="br0">&#93;</span>  
107   <span class="kw1">in</span>  smallerSorted <span class="sy0">++</span> <span class="br0">&#91;</span>x<span class="br0">&#93;</span> <span class="sy0">++</span> biggerSorted
108 &nbsp;
109 divideByTen <span class="sy0">::</span> <span class="br0">&#40;</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">&#41;</span> <span class="sy0">=&gt;</span> a <span class="sy0">-&gt;</span> a  
110 divideByTen <span class="sy0">=</span> <span class="br0">&#40;</span><span class="sy0">/</span><span class="nu0">10</span><span class="br0">&#41;</span>                    <span class="co1">--section, infix function partial application</span>
111 &nbsp;
112 <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">&#40;</span>a <span class="sy0">-&gt;</span> b <span class="sy0">-&gt;</span> c<span class="br0">&#41;</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</span>a<span class="br0">&#93;</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</span>b<span class="br0">&#93;</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</span>c<span class="br0">&#93;</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">&#91;</span><span class="br0">&#93;</span> <span class="sy0">_</span> <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#93;</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="sy0">_</span> <span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#93;</span>  
115 <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">&#40;</span>x:xs<span class="br0">&#41;</span> <span class="br0">&#40;</span>y:ys<span class="br0">&#41;</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
116 &nbsp;
117 <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">&#40;</span>a <span class="sy0">-&gt;</span> b<span class="br0">&#41;</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</span>a<span class="br0">&#93;</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</span>b<span class="br0">&#93;</span>  
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">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#93;</span>  
119 <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">&#40;</span>x:xs<span class="br0">&#41;</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
120 &nbsp;
121 <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">&#40;</span>a <span class="sy0">-&gt;</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">&#41;</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</span>a<span class="br0">&#93;</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</span>a<span class="br0">&#93;</span>  
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">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#93;</span>  
123 <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">&#40;</span>x:xs<span class="br0">&#41;</span>   
124   <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  
125   <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
126 <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">&#91;</span>x <span class="sy0">|</span> x <span class="sy0">&lt;-</span> l<span class="sy0">,</span> p x<span class="br0">&#93;</span>
127 &nbsp;
128 quicksort <span class="sy0">::</span> <span class="br0">&#40;</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">&#41;</span> <span class="sy0">=&gt;</span> <span class="br0">&#91;</span>a<span class="br0">&#93;</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</span>a<span class="br0">&#93;</span>    
129 quicksort <span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#93;</span>    
130 quicksort <span class="br0">&#40;</span>x:xs<span class="br0">&#41;</span> <span class="sy0">=</span>     
131   <span class="kw1">let</span> smallerSorted <span class="sy0">=</span> quicksort <span class="br0">&#40;</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">&#40;</span><span class="sy0">&lt;=</span>x<span class="br0">&#41;</span> xs<span class="br0">&#41;</span>  
132       biggerSorted <span class="sy0">=</span> quicksort <span class="br0">&#40;</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">&#40;</span><span class="sy0">&gt;</span>x<span class="br0">&#41;</span> xs<span class="br0">&#41;</span>   
133   <span class="kw1">in</span>  smallerSorted <span class="sy0">++</span> <span class="br0">&#91;</span>x<span class="br0">&#93;</span> <span class="sy0">++</span> biggerSorted
134 &nbsp;
135 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:sum"><span class="kw3">sum</span></a> <span class="br0">&#40;</span>takeWhile <span class="br0">&#40;</span><span class="sy0">&lt;</span>10000<span class="br0">&#41;</span> <span class="br0">&#40;</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">&#40;</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">&#40;</span><span class="sy0">^</span><span class="nu0">2</span><span class="br0">&#41;</span> <span class="br0">&#91;</span>1<span class="sy0">..</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="co1">--sum of all odd squares that are smaller than 10,000</span>
136 &nbsp;
137 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:zipWith"><span class="kw3">zipWith</span></a> <span class="br0">&#40;</span><span class="sy0">+</span><span class="br0">&#41;</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">&#40;</span>\a b <span class="sy0">-&gt;</span> a <span class="sy0">+</span> b<span class="br0">&#41;</span> l r  <span class="co1">--lamba function</span>
138 &nbsp;
139 <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">&#40;</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">&#41;</span> <span class="sy0">=&gt;</span> <span class="br0">&#91;</span>a<span class="br0">&#93;</span> <span class="sy0">-&gt;</span> a  
140 <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">&#40;</span>\acc x <span class="sy0">-&gt;</span> acc <span class="sy0">+</span> x<span class="br0">&#41;</span> 0 xs
141 <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">&#40;</span><span class="sy0">+</span><span class="br0">&#41;</span> 0
142 &nbsp;
143 <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">&#40;</span>\acc x <span class="sy0">-&gt;</span> acc <span class="sy0">||</span> x <span class="sy0">==</span> y<span class="br0">&#41;</span> False ys
144 &nbsp;
145 <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">&#40;</span>a <span class="sy0">-&gt;</span> b<span class="br0">&#41;</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</span>a<span class="br0">&#93;</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</span>b<span class="br0">&#93;</span>
146 <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">&#40;</span>\x acc <span class="sy0">-&gt;</span> f x : acc<span class="br0">&#41;</span> <span class="br0">&#91;</span><span class="br0">&#93;</span> xs
147 &nbsp;
148 <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">&#40;</span>a <span class="sy0">-&gt;</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">&#41;</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</span>a<span class="br0">&#93;</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</span>a<span class="br0">&#93;</span>  
149 <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">&#40;</span>\x acc <span class="sy0">-&gt;</span> <span class="kw1">if</span> p x <span class="kw1">then</span> x : acc <span class="kw1">else</span> acc<span class="br0">&#41;</span> <span class="br0">&#91;</span><span class="br0">&#93;</span>
150 &nbsp;
151 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:scanl"><span class="kw3">scanl</span></a> <span class="br0">&#40;</span><span class="sy0">+</span><span class="br0">&#41;</span> <span class="nu0">0</span> <span class="br0">&#91;</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">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</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">&#93;</span>  <span class="co1">--fold that keeps partial results</span>
152 &nbsp;
153 <span class="br0">&#40;</span><span class="sy0">$</span><span class="br0">&#41;</span> <span class="sy0">::</span> <span class="br0">&#40;</span>a <span class="sy0">-&gt;</span> b<span class="br0">&#41;</span> <span class="sy0">-&gt;</span> a <span class="sy0">-&gt;</span> b  
154 f <span class="sy0">$</span> x <span class="sy0">=</span> f x                             <span class="co1">--function application function</span>
155 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"><span class="kw3">map</span></a> <span class="br0">&#40;</span><span class="sy0">$</span> <span class="nu0">3</span><span class="br0">&#41;</span> <span class="br0">&#91;</span><span class="br0">&#40;</span><span class="nu0">4</span><span class="sy0">+</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="br0">&#40;</span><span class="nu0">10</span><span class="sy0">*</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="br0">&#40;</span><span class="sy0">^</span><span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</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">&#93;</span> <span class="co1">--mapping function application</span>
156 &nbsp;
157 <span class="br0">&#40;</span><span class="sy0">.</span><span class="br0">&#41;</span> <span class="sy0">::</span> <span class="br0">&#40;</span>b <span class="sy0">-&gt;</span> c<span class="br0">&#41;</span> <span class="sy0">-&gt;</span> <span class="br0">&#40;</span>a <span class="sy0">-&gt;</span> b<span class="br0">&#41;</span> <span class="sy0">-&gt;</span> a <span class="sy0">-&gt;</span> c  
158 f <span class="sy0">.</span> g <span class="sy0">=</span> \x <span class="sy0">-&gt;</span> f <span class="br0">&#40;</span>g x<span class="br0">&#41;</span>                       <span class="co1">--function composition function</span>
159 &nbsp;
160 <span class="kw1">import</span> Data<span class="sy0">.</span>List                            <span class="co1">--import Data.List module</span>
161 :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>
162 <span class="kw1">import</span> Data<span class="sy0">.</span>List <span class="br0">&#40;</span>nub<span class="sy0">,</span> sort<span class="br0">&#41;</span>                <span class="co1">--import just nub and sort</span>
163 <span class="kw1">import</span> Data<span class="sy0">.</span>List <span class="kw1">hiding</span> <span class="br0">&#40;</span>nub<span class="br0">&#41;</span>               <span class="co1">--import all except nub</span>
164 <span class="kw1">import</span> <span class="kw1">qualified</span> Data<span class="sy0">.</span>Map                   <span class="co1">--force qualification</span>
165 <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>
166 &nbsp;
167 <span class="coMULTI">{-
168   this is a
169   multiline comment
170 -}</span>
171 &nbsp;
172 intersperse <span class="nu0">0</span> <span class="br0">&#91;</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">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</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">&#93;</span>
173 intercalate <span class="st0">&quot; - &quot;</span> <span class="br0">&#91;</span><span class="st0">&quot;hey&quot;</span><span class="sy0">,</span><span class="st0">&quot;there&quot;</span><span class="sy0">,</span><span class="st0">&quot;guys&quot;</span><span class="br0">&#93;</span> <span class="sy0">==</span> <span class="st0">&quot;hey - there - guys&quot;</span>
174 transpose <span class="br0">&#91;</span><span class="br0">&#91;</span>1<span class="sy0">,</span>2<span class="sy0">,</span>3<span class="br0">&#93;</span><span class="sy0">,</span><span class="br0">&#91;</span>4<span class="sy0">,</span>5<span class="sy0">,</span>6<span class="br0">&#93;</span><span class="sy0">,</span><span class="br0">&#91;</span>7<span class="sy0">,</span>8<span class="sy0">,</span>9<span class="br0">&#93;</span><span class="br0">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>1<span class="sy0">,</span>4<span class="sy0">,</span>7<span class="br0">&#93;</span><span class="sy0">,</span><span class="br0">&#91;</span>2<span class="sy0">,</span>5<span class="sy0">,</span>8<span class="br0">&#93;</span><span class="sy0">,</span><span class="br0">&#91;</span>3<span class="sy0">,</span>6<span class="sy0">,</span>9<span class="br0">&#93;</span><span class="br0">&#93;</span>
175 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:concat"><span class="kw3">concat</span></a> <span class="br0">&#91;</span>1<span class="sy0">,</span> 2<span class="br0">&#93;</span> <span class="br0">&#91;</span>3<span class="sy0">,</span> 4<span class="sy0">,</span> 5<span class="br0">&#93;</span> <span class="sy0">==</span> <span class="br0">&#91;</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">&#93;</span>
176 <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
177 &nbsp;
178 <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">&#40;</span><span class="sy0">&gt;</span>4<span class="br0">&#41;</span> <span class="br0">&#91;</span>5<span class="sy0">,</span>6<span class="sy0">,</span>7<span class="sy0">,</span>8<span class="br0">&#93;</span> <span class="sy0">==</span> True
179 <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">&#40;</span><span class="sy0">&gt;</span>4<span class="br0">&#41;</span> <span class="br0">&#91;</span>1<span class="sy0">,</span>2<span class="sy0">,</span>3<span class="br0">&#93;</span> <span class="sy0">==</span> False
180 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:any"><span class="kw3">any</span></a> <span class="br0">&#40;</span><span class="sy0">==</span>4<span class="br0">&#41;</span> <span class="br0">&#91;</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">&#93;</span> <span class="sy0">==</span> True
181 <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:all"><span class="kw3">all</span></a> <span class="br0">&#40;</span><span class="sy0">==</span><span class="nu0">4</span><span class="br0">&#41;</span> <span class="br0">&#91;</span><span class="nu0">2</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">6</span><span class="sy0">,</span><span class="nu0">1</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">&#93;</span> <span class="sy0">==</span> False