HaskellWiki

Haskell | Wiki community | Recent changes
Random page | Special pages

 

Not logged in
Log in | Help

Cum se aplica o lista de functii pe o valoare ?

Categories: Ro

Folosind vechea noastra cunostinta map si operatorul $ putem sa transferam o singura valoare (argument) unei liste de functii:


Exemplul 1:

Prelude> map ($ 0)  [(1+),(2+),(23+)]
[1,2,23]

Exemplul 2:

Prelude> map ($ 1) [(\x -> x+1) , (20+), (\y -> y *y) ]
[2,21,1]
Prelude> map ($ 2) [(\x -> x+1) , (20+), (\y -> y *y) ]
[3,22,4]
Prelude> map ($ 3) [(\x -> x+1) , (20+), (\y -> y *y) ]
[4,23,9]
Prelude>

Nota: Bineinteles ca functiile trebuie sa aiba acelasi tip.


Pagina indexata la indexul Categories:Ro


<= Inapoi la pagina principala Ro/Haskell.

<- Inapoi la Intrebarile incepatorului Ro/Haskell.

Retrieved from "http://haskell.org/haskellwiki/Cum_se_aplica_o_lista_de_functii_pe_o_valoare_%3F"

This page has been accessed 280 times. This page was last modified 09:32, 23 January 2008. Recent content is available under a simple permissive license.