Update of /cvsroot/wisp/wisp/src/builtin
In directory usw-pr-cvs1:/tmp/cvs-serv4586/src/builtin
Modified Files:
lists.wisp
Log Message:
Made |length| able to access length of strings and vectors.
Index: lists.wisp
===================================================================
RCS file: /cvsroot/wisp/wisp/src/builtin/lists.wisp,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- lists.wisp 26 Aug 2002 16:20:08 -0000 1.103
+++ lists.wisp 7 Sep 2002 21:54:55 -0000 1.104
@@ -125,10 +125,15 @@
; {{{ |length|
(define (length x)
- (let (length (x x))
- (if (cons? x)
- (+ (length (cdr x)) 1)
- 0)))
+ (case x
+ (string? (string-length x))
+ (vector? (vector-length x))
+ (else
+ (my l 0
+ (while (cons? x)
+ (incr! l)
+ (cdr! x))
+ l))))
; }}}
; {{{ |length?|
|