Commit 1fcfd332 by Mart Lubbers

### Add array comprehension to builtin syntax

`This resolves some tasks from #180.`
parent 5e1d44cc
 ... ... @@ -601,8 +601,10 @@ bs_with = bs_zf = { syntax_title = "list comprehension" , syntax_patterns = ["ZF-expression", "ZF", "zf", "comprehension", "<-", "<|-", "<-:", "\\\\", ",", "&", "|"] , syntax_code = ["[... \\\\ ... <- ...]"] , syntax_description = "Constructs a list composed of elements drawn from other lists or arrays." , syntax_code = ["[... \\\\ ... <- ...]" ,"{... \\\\ ... <- ...}"] , syntax_description = "Constructs a list or array composed of elements drawn from other lists or arrays." , syntax_doc_locations = [CLR 6 "4.2.1" "_Toc311798024"] , syntax_examples = map (EXs "macro") [ "cartesian = [(x,y) \\\\ x <- [1,2,3], y <- [10,20]] // Cartesian product: (1,10), (1,20), (2,10), (2,20), (3,10), (3,20)" ... ... @@ -611,6 +613,7 @@ bs_zf = , "catMaybes ms = [x \\\\ Just x <- ms] // Pattern matching in the selector" , "triangle = [(x,y) \\\\ x <- [1,2,3], y <- [1..x]] // Reusing x in the next generator: (1,1), (2,1), (2,2), (3,1), (3,2), (3,3)" , "arrToList a = [x \\\\ x <-: a] // <-: for arrays" , "listToArr l = {x \\\\ x <- l} // <-: for arrays" , "castList xs = [|x \\\\ x <|- xs] // The two pipe characters make both xs and the result overloaded lists" ] }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!