Q&A's, tips, howto's
-
iNPRwANG
- Posts: 32
- Joined: Sun May 08, 2011 1:45 pm
Post
by iNPRwANG »
This is code:
Code: Select all
(setq mylst '(nil nil nil nil nil nil nil nil nil nil nil nil))
(dolist (item mylst) (println (length item)))
Why the result is:
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
-
rickyboy
- Posts: 607
- Joined: Fri Apr 08, 2005 7:13 pm
- Location: Front Royal, Virginia
Post
by rickyboy »
Because (length 'nil) is 3.
On the other hand, (length nil) is 0.
(λx. x x) (λx. x x)
-
iNPRwANG
- Posts: 32
- Joined: Sun May 08, 2011 1:45 pm
Post
by iNPRwANG »
OK, thx.
The difference with common lisp is: In common lisp the (length 'nil) is zero, and in newlisp is the symbols length.