Skip to content

Make searching example more lazy#156

Open
MatthijsBlom wants to merge 2 commits intolearnyouahaskell:mainfrom
MatthijsBlom:foldl
Open

Make searching example more lazy#156
MatthijsBlom wants to merge 2 commits intolearnyouahaskell:mainfrom
MatthijsBlom:foldl

Conversation

@MatthijsBlom
Copy link
Copy Markdown
Contributor

The old implementation was insufficiently lazy: it would insist on walking the entire list and therefore fail on

ouch = error "ouch"
ugh  = error "ugh"

-- >>> search [2,3] ( 1 : 2 : 3 : ouch : 5 : 6 : ugh )

Left folds aren't appropriate to this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant