Talk:How to work on lists

From HaskellWiki
Revision as of 11:38, 22 January 2007 by MathematicalOrchid (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.

on the topic of slower operations: it should be noted that filter, map, zip, etc. are only O(n) if the whole list is evaluated. since these are lazy functions any of these will be O(1):

head $ map (+1) [0..]
(filter even [0..])!!5
take 5 $ zip [0..] [5..]

--Johannes Ahlmann 23:44, 21 January 2007 (UTC)


Ah yes, quite right. All of the complexity descriptions only apply if you actually use all of the list. I should probably mention that somewhere...

MathematicalOrchid 11:38, 22 January 2007 (UTC)