Programowanie w systemie UNIX/Haskell: Różnice pomiędzy wersjami
Usunięta treść Dodana treść
m →Zobacz również: pomoc |
m →Funkcje: nowe |
||
Linia 41:
==Funkcje==
== definicje==
* w kodzie
**
* w osobnym pliku
let f :: a -> a ; f x = x -- GHCI , one line, signature
let { fact 0 = 1 ; fact n = n * fact (n-1) } -- use braces with semicolons separating the definitions
<source lang=haskell}
-- https://pl.wikibooks.org/w/index.php?title=Programowanie_w_systemie_UNIX/Haskell&action=edit§ion=5
> :set +m
> let a 0 = 0
| a x = 1 + b x
| b x = 2 + a (x - 1)
> a 1
3
</source>
===Kwadrat liczby===
|