I'm attempting to write a function that prints each entry of a list on its own line using by re-cursing on the tail. Here's what I have:
Code: Select all
(define print-list
(lambda (l)
(if (null? l)
(display "done\n")
( (display (car l)) (newline) (print-list (cdr l)) ))))
(print-list '(1 2 3 4 5) )
Code: Select all
john@home:~/code/lisp$ tinyscheme helloworld.scm
1
2
3
4
5
done
Error: (helloworld.scm : 8) illegal function
Errors encountered reading helloworld.scm
john@home:~/code/lisp$
Thanks very much in advance!