aboutsummaryrefslogtreecommitdiff
path: root/lib/collections.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2017-10-09 20:17:38 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2017-10-09 20:17:38 -0700
commita858775a6831e5d880d9c0f88470f12a7e9b91f9 (patch)
treeb2abd90975ff0aabbe84173e41a373c9d365e40c /lib/collections.nom
parentf553bf2948dc8ece1c9ec98df3efd6ce6cc4e56e (diff)
Fixing up sorting more.
Diffstat (limited to 'lib/collections.nom')
-rw-r--r--lib/collections.nom10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/collections.nom b/lib/collections.nom
index 43dfb08..4d459b7 100644
--- a/lib/collections.nom
+++ b/lib/collections.nom
@@ -1,4 +1,5 @@
require "lib/metaprogramming.nom"
+require "lib/utils.nom"
require "lib/control_flow.nom"
require "lib/operators.nom"
@@ -116,6 +117,15 @@ compile [%expression for %var in %iterable] to:
|end)(game, setmetatable({}, {__index=vars}))
parse [%expression for all %iterable] as: %expression for % in %iterable
+rule [%items sorted] =:
+ %copy = (% for all %items)
+ sort %copy
+ %copy
+rule [%items sorted by %key] =:
+ %copy = (% for all %items)
+ sort %copy by %key
+ %copy
+
# TODO: maybe make a generator/coroutine?
#.. Dict comprehensions can be accomplished okay by doing: