Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2017-12-04 13:54:28 -0500
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-09-11 09:30:51 -0400
commit24e578c7aece518c47ec4059264f754af6e5aa8d (patch)
treecf62cf23f5b11bb7e56a97726f07fefe5ba45110
parentb33f8bb999cab680bf648671e90c563afea93ba3 (diff)
downloadtame-24e578c7aece518c47ec4059264f754af6e5aa8d.tar.gz
tame-24e578c7aece518c47ec4059264f754af6e5aa8d.tar.bz2
tame-24e578c7aece518c47ec4059264f754af6e5aa8d.zip
_cons-until-empty_: Add @index@
This is much more general-purpose and is necessary when operating on more than one list. * vector/list.xml: Add numeric/common import, exported. (_cons-until-empty_): Add @index@, incremented at each recursion.
-rw-r--r--core/vector/list.xml29
1 files changed, 28 insertions, 1 deletions
diff --git a/core/vector/list.xml b/core/vector/list.xml
index 76dde2d..0b8e00e 100644
--- a/core/vector/list.xml
+++ b/core/vector/list.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
- Copyright (C) 2015 LoVullo Associates, Inc.
+ Copyright (C) 2015, 2017 LoVullo Associates, Inc.
This file is part of tame-core.
@@ -25,6 +25,8 @@
<import package="../base" />
+ <import package="../numeric/common" export="true" />
+
<!--
@@ -43,6 +45,7 @@
<param name="@cdr@" desc="Variable in which to store the cdr of the set">
<text>__cdr</text>
</param>
+ <param name="@index@" desc="Index variable" />
<param name="@base@" desc="Base set to return (otherwise an empty set)" />
<param name="@glance@" desc="Glance at (but do nothing with) this value; recurse without action" />
@@ -115,6 +118,14 @@
<c:arg name="@set@">
<c:value-of name="@cdr@" />
</c:arg>
+
+ <if name="@index@">
+ <c:arg name="@index@">
+ <t:inc>
+ <c:value-of name="@index@" />
+ </t:inc>
+ </c:arg>
+ </if>
</c:recurse>
</c:case>
</if>
@@ -133,6 +144,14 @@
<c:arg name="@set@">
<c:value-of name="@cdr@" />
</c:arg>
+
+ <if name="@index@">
+ <c:arg name="@index@">
+ <t:inc>
+ <c:value-of name="@index@" />
+ </t:inc>
+ </c:arg>
+ </if>
</c:recurse>
</c:cons>
</unless>
@@ -146,6 +165,14 @@
<c:arg name="@set@">
<c:value-of name="@cdr@" />
</c:arg>
+
+ <if name="@index@">
+ <c:arg name="@index@">
+ <t:inc>
+ <c:value-of name="@index@" />
+ </t:inc>
+ </c:arg>
+ </if>
</c:recurse>
</c:arg>