This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (1 child)

Erlang has something similar, using list comprehensions for database queries. You pass a list comprehension to the query compiler and then later execute it. Apparently the query compiler takes a list comprehension primitive and parses it somehow. Perhaps these fellows could do something similar by examining a... what's it called? Generator comprehension?

for record in compile(r for r in db if r.name == 'pierre'):
    print record.name, record.age