From 76cc8e97a2cf3265b39cb6c1b444c7926871f6a0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 28 Jul 2015 18:39:00 +0200 Subject: Add sort primop --- doc/manual/expressions/builtins.xml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'doc/manual') diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml index 4461570565e1..6642513f6521 100644 --- a/doc/manual/expressions/builtins.xml +++ b/doc/manual/expressions/builtins.xml @@ -779,6 +779,29 @@ builtins.replaceStrings ["oo" "a"] ["a" "i"] "foobar" + builtins.sort + comparator list + + Return list in sorted + order. It repeatedly calls the function + comparator with two elements. The + comparator should return true if the first + element is less than the second, and false + otherwise. For example, + + +builtins.sort builtins.lessThan [ 483 249 526 147 42 77 ] + + + produces the list [ 42 77 147 249 483 526 + ]. + + This is a stable sort: it preserves the relative order of + elements deemed equal by the comparator. + + + + builtins.stringLength e -- cgit 1.4.1