Personal tools

Cum poate fi definit sequence ?

From HaskellWiki

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

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 () )