From 50807f3dd5241667dac0c0cc302042d648de4b42 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 28 Jul 2015 17:27:32 +0200 Subject: Add primop genList MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This can be used to implement functions like ‘imap’ (or for that matter, ‘map’) without the quadratic complexity incurred by calling ‘++’ repeatedly. --- doc/manual/expressions/builtins.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'doc/manual') diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml index 099f90e786e5..4461570565e1 100644 --- a/doc/manual/expressions/builtins.xml +++ b/doc/manual/expressions/builtins.xml @@ -364,6 +364,24 @@ builtins.fromJSON ''{"x": [1, 2, 3], "y": null}'' + builtins.genList + generator length + + Generate list of size + length, with each element + i> equal to the value returned by + generator i. For + example, + + +builtins.genList (x: x * x) 5 + + + returns the list [ 0 1 4 9 16 ]. + + + + builtins.getAttr s set -- cgit 1.4.1