backup de julho
[h2N7SspZmY.git] / data / cache / 7 / 7ce799680ed08e7b5f5f3600e66f8e5c.code
blob99fa5fddfea7c646cebb974574ff2d7bab19f44b
1 :l myfunctions <span class="co1">--load the functions in the file myfunctions.hs</span>
2 :r             <span class="co1">--reload</span>
3 <span class="nu0">1</span> <span class="sy0">/=</span> <span class="nu0">0</span>         <span class="co1">--not equal</span>
4 <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>
5 <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>
6 <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>
7 <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>
8 mysucc x <span class="sy0">=</span> x <span class="sy0">+</span> <span class="nu0">1</span>     <span class="co1">--function definition</span>
9 <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>
10 <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>
11 <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>
12 <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
13 <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>
14 <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>
15 <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
16 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>