aboutsummaryrefslogtreecommitdiff
path: root/core/collections.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-02-05 15:10:22 -0800
committerBruce Hill <bitbucket@bruce-hill.com>2018-02-05 15:10:53 -0800
commit667e5f3f81d61eb2f38225c08b8fd213d2f862cd (patch)
tree62f19aaeaaefc1b213a5b2452282c31938a175e5 /core/collections.nom
parentf58dc0fcb7979ae9f67ab3b5daebc8c4a4d652ca (diff)
Fixed bug with iteration over range that starts after 1, and added an
append alias that puts the list first.
Diffstat (limited to 'core/collections.nom')
-rw-r--r--core/collections.nom4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/collections.nom b/core/collections.nom
index 6882c96..551917f 100644
--- a/core/collections.nom
+++ b/core/collections.nom
@@ -50,7 +50,7 @@ immediately:
compile [length of %list, size of %list, size %list, number of %list, len %list] to:
{expr:"utils.size(\(%list as lua expr))"}
- compile [append %item to %list, add %item to %list] to:
+ compile [append %item to %list, add %item to %list, to %list add %item, to %list append %item] to:
{statements:"table.insert(\(%list as lua expr), \(%item as lua expr))"}
compile [pop from %list, remove last from %list] to:
@@ -86,7 +86,7 @@ immediately:
(function()
local comprehension = {};
for \(%index as lua expr)=\(%start as lua expr),\(%stop as lua expr),\(%step as lua expr) do
- comprehension[\(%index as lua expr)] = \(%expression as lua expr);
+ comprehension[#comprehension+1] = \(%expression as lua expr);
end
return comprehension;
end)()