Personal tools

Cum poate fi definit sequence ?

From HaskellWiki

Revision as of 21:05, 5 January 2008 by Ha$kell (Talk | contribs)

Jump to: navigation, search

1) In do-notatie, in mod recursiv ar putea fi definit ca:

sequence_         :: [ IO() ] -> IO ()
sequence_  []     = return ()
sequence_  (a:as) = do a
                       sequence_ as

2) Vazut ca un foldr ar putea fi definit ca:

sequence_ = foldr (>>) (return () )

<= Inapoi la pagina principala Ro/Haskell