Ticket #23 (closed bug report: fixed)
Missing support for generalised list comprehensions
|Reported by:||nibro||Owned by:||nibro|
|Priority:||minor||Milestone:||Full code support|
This extension allows SQL-like clauses in list comprehensions:
employees = [ ("Simon", "MS", 80) , ("Erik", "MS", 100) , ("Phil", "Ed", 40) , ("Gordon", "Ed", 45) , ("Paul", "Yale", 60)] output = [ (the dept, sum salary) | (name, dept, salary) <- employees , then group by dept , then sortWith by (sum salary) , then take 5 ]
Should be trivial to implement parser-wise, like with parallel list comprehensions the main question is how to support these in the AST. Probably keep them separate from ordinary statements. Also I need to investigate if/how parallel and generalised list comprehensions go together. My guess is they simply don't.