14.11.2012 Views

Curry: An Integrated Functional Logic Language

Curry: An Integrated Functional Logic Language

Curry: An Integrated Functional Logic Language

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

• The sequence [e1..e2] denotes the finite list [e1,e1+1,e1+2,...,e2]. Note that the list is<br />

empty if e1 > e2.<br />

• The sequence [e1,e2..] denotes the infinite list [e1,e1+i,e1+2*i,...] with i = e2 −e1. Note<br />

that i could be positive, negative or zero.<br />

• The sequence [e1,e2..e3] denotes the finite list [e1,e1+i,e1+2*i,...,e3] with i = e2 − e1.<br />

Note that e3 is not contained in this list if there is no integer m with e3 = e1 + m ∗ i.<br />

For instance, [0,2..10] denotes the list [0,2,4,6,8,10].<br />

5.2 List Comprehensions<br />

The second compact notation for lists are list comprehensions. They have the general form<br />

[ e | q1 ,..., qk ]<br />

where k ≥ 1 and each qi is a qualifier that is either<br />

• a generator of the form p

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!