[Haskell-beginners] Searching Maybe lists

Antoine Latter aslatter at gmail.com
Mon May 18 23:26:46 EDT 2009


On Mon, May 18, 2009 at 9:56 PM, aditya siram <aditya.siram at gmail.com> wrote:
>
> Curiously, the regular 'Data.List.find' function that applies a Boolean
> predicate to each member of the list also seems to first traverse the entire
> list using 'filter' and then grabs the head of the result.
>

Ah!  I just thought I'd point out that 'filter' does not necessarily
traverse the entire list if all you do with the result is grab the
head - it only traverses enough of the list to figure out what the
head of the list should be (or even that it exists).

Haskell is lazy :-)

Antoine


More information about the Beginners mailing list