commit 3be3dd2b2f38086868edd20b579bd9dd1b28aed7
parent adc9a7e087096d979695e09f8c33f4952b7c643b
Author: Alexander Burger <abu@software-lab.de>
Date: Sat, 2 Mar 2013 18:43:36 +0100
'fold' analog to 'lowc' / 'uppc'
Diffstat:
5 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/CHANGES b/CHANGES
@@ -1,4 +1,5 @@
* DDmmm13 picoLisp-3.1.2
+ 'fold' analog to 'lowc' / 'uppc'
'fold' second arg default zero
Removed 'dbg' startup script
Trim trailing spaces in "lib/form.js"
diff --git a/doc/refF.html b/doc/refF.html
@@ -285,11 +285,11 @@ href="refO.html#oct">oct</a></code>.
</code></pre>
<dt><a name="fold"><code>(fold 'any ['cnt]) -> sym</code></a>
-<dd>Folding to a canonical form: If <code>any</code> is not a symbol,
-<code>NIL</code> is returned. Otherwise, a new transient symbol with all digits
-and all letters of <code>any</code>, converted to lower case, is returned. If
-the <code>cnt</code> argument is given and non-zero, the result is truncated to
-that length. See also <code><a href="refL.html#lowc">lowc</a></code>.
+<dd>Folding to a canonical form: If <code>any</code> is not a symbol, it is
+returned as it is. Otherwise, a new transient symbol with all digits and all
+letters of <code>any</code>, converted to lower case, is returned. If the
+<code>cnt</code> argument is given and non-zero, the result is truncated to that
+length. See also <code><a href="refL.html#lowc">lowc</a></code>.
<pre><code>
: (fold " 1A 2-b/3")
diff --git a/src/sym.c b/src/sym.c
@@ -1,4 +1,4 @@
-/* 01mar13abu
+/* 02mar13abu
* (c) Software Lab. Alexander Burger
*/
@@ -1999,7 +1999,7 @@ any doFold(any ex) {
x = cdr(ex);
if (!isSym(x = EVAL(car(x))) || !(c = symChar(name(x))))
- return Nil;
+ return x;
while (!isLetterOrDigit(c))
if (!(c = symChar(NULL)))
return Nil;
diff --git a/src64/sym.l b/src64/sym.l
@@ -1,4 +1,4 @@
-# 01mar13abu
+# 02mar13abu
# (c) Software Lab. Alexander Burger
### Compare long names ###
@@ -3578,14 +3578,10 @@
ld X (L I) # Get result
call consSymX_E # Make transient symbol
drop
- pop Y
- pop X
- ret
end
end
end
end
- ld E Nil
pop Y
pop X
ret
diff --git a/src64/tags b/src64/tags
@@ -932,7 +932,7 @@ sys/x86-64.linux.defs.l,1959
doLowc3417,78757
doUppc3469,80265
doFold3521,81780
-isLetterOrDigitA_F3593,83886
+isLetterOrDigitA_F3589,83813
./db.l,1153
getAdrZ_A6,117