Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - bluenote

#1
Hi There,



The generic list algorithm in the http://www.newlisp.org/newLISP_in_21_minutes.html">interactive tutorialproduces an error when I try to evaluate it.



I was able to fix up the code and get it working (provided below) as per the spirit of the tutorial. Perhaps that tutorial is out of date to newer language features or something.





Old non-working code
(define (list-length a-list)
(if (first a-list)
  (+ 1 (list-length (rest a-list)))
  0))


My modified version which seems to work


(define (list-length a-list)
(if a-list
  (+ 1 (list-length (rest a-list)))
  0))