--- a/Cons.st Wed Jun 25 19:07:30 2014 +0200
+++ b/Cons.st Wed Jun 25 19:08:56 2014 +0200
@@ -680,6 +680,8 @@
len := 1.
p := self.
[(rest := p cdr) notNil] whileTrue:[
+ rest isCons ifFalse:[^ len].
+
len := len + 1.
p := rest
].
@@ -688,6 +690,7 @@
"
(Cons fromArray:#(1)) length
(Cons fromArray:#(1 2 3 4)) length
+ (Cons car:1 cdr:2) length
"
!
@@ -712,10 +715,10 @@
!Cons class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/Cons.st,v 1.23 2014-06-25 17:07:25 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/Cons.st,v 1.24 2014-06-25 17:08:56 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic2/Cons.st,v 1.23 2014-06-25 17:07:25 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/Cons.st,v 1.24 2014-06-25 17:08:56 cg Exp $'
! !