From 667e5f3f81d61eb2f38225c08b8fd213d2f862cd Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 5 Feb 2018 15:10:22 -0800 Subject: [PATCH] Fixed bug with iteration over range that starts after 1, and added an append alias that puts the list first. --- core/collections.nom | 4 ++-- 1 file 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)()