From 783eec9b4592ff3fa54ffa1a855dda2a71f2db64 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 13 Mar 2019 20:55:24 -0700 Subject: Made iteration easier to work with by using .__inext and .__next for custom iteration, and a custom ipairs() and pairs() to use that. --- lib/core/collections.nom | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/core/collections.nom') diff --git a/lib/core/collections.nom b/lib/core/collections.nom index 9741faa..60eee3c 100644 --- a/lib/core/collections.nom +++ b/lib/core/collections.nom @@ -180,7 +180,6 @@ test: for $ in $r: $visited, add $ assume ($visited == [1, 3, 5, 7, 9]) -$(inext) = (=lua "ipairs({})") $range_mt = { .__type = "a Range" .__index = @@ -212,7 +211,8 @@ $range_mt = { ($self.last == $other.last) and ($self.step == $other.step) .backwards = (for $self ($self.last to $self.first by (- $self.step))) - .__ipairs = (for $self: return $(inext) $self 0) + .__inext = $(inext) + .__next = $(inext) .as_text = for $self: if ($self.step == 1): -- cgit v1.2.3