List Comprehension

A list comprehension is a Haskell syntax that is similar to "set comprehensions" or "set-builder notation", ie the notation
S=\{x|x \in \mathbb{N}, x^2>3\}
In Haskell list comprehensions this would be written as
  S = | x<-[0.., x^2>3]   
where 0.. represents N, and x^2>3 represents the conditional. It is clear that the two notations are almost identical. The Haskell interpreter actually converts instances of list comprehensions to expressions involving the higher-order functions map and filter. For example S above can be written as
  S = filter (\x -> x^2 > 3) 0..  
The Python programming language has a near-equivalent mechanism for expressing list comprehensions. Corresponding example would be:
  L = range(100) # this produces a list of integers from 0 to 99  
S = for x in L if x**2 > 3

 

<< PreviousWord BrowserNext >>
list of electronic music record labels
ansett
digital imaging
how to be good
sasha
benjamin stoddert
scaphion
certification mark
parry (fencing)
list of industrial music artists
australian horse racing
cabaret voltaire (band)
cleanroom
caveat emptor
marsaxlokk
digital radio mondiale
all indian professional rodeo cowboys association
indian rodeo
resolution (music)
digital radio
shackle
megavoltage
saab draken
radiation therapist
isocentric technique
motoi sakuraba
second war against napoleon
first war against napoleon
ozark patriots
treaty of paris (1810)
dendermonde puurs steam railway
ocs
counting
harry ramsden's
cmf
martha griffiths
list of mathematical topics (g i)
common whipping
officer candidate school
grand valley state university
old king cole
ceol
cole
balti