diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-03-13 20:55:24 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-03-13 20:55:59 -0700 |
| commit | 783eec9b4592ff3fa54ffa1a855dda2a71f2db64 (patch) | |
| tree | 3c03408a582b26e6d7fa37f661b695bb6c39ece3 /lib/core/collections.nom | |
| parent | 1e99bbbe0a12b85800d316fcccd993591dde2431 (diff) | |
Made iteration easier to work with by using .__inext and .__next for
custom iteration, and a custom ipairs() and pairs() to use that.
Diffstat (limited to 'lib/core/collections.nom')
| -rw-r--r-- | lib/core/collections.nom | 4 |
1 files changed, 2 insertions, 2 deletions
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): |
