Skip to content

Instantly share code, notes, and snippets.

@JakubOboza
Created June 14, 2013 09:14
Show Gist options
  • Save JakubOboza/5780560 to your computer and use it in GitHub Desktop.
Save JakubOboza/5780560 to your computer and use it in GitHub Desktop.
List Comperhansions
-- ghci example
let infinite_list = [1..n]
take 50 infinite_list
-- works fine and its great :)
let triangles = [(a,b,c) | a <-[1..], b<-[1..], c<-[1..], c^2 == a^2 + b^2]
take 50 triangles
-- boom :) is list comp* strict evaluated ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment