Cum poate fi definit sequence ?

From HaskellWiki
Revision as of 21:05, 5 January 2008 by Ha$kell (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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