A small typo: I think you meant
(define (nth n l)
(if (or (>= n (length l)) (< n 0))
(error "Index out of bounds.")
(if (eq? n 0)
(car l)
(nth (- n 1) (cdr l)))))
The various Schemes are less alike than the various Common Lisps --
Scheme exists in something like 40 implementations, and the implementors
tend to be cantankerous and disdainful of standards. So online docs can
be
misleading. s7.html describes s7, and I try to stay within shouting
distance of the r7rs standard, but I'd say s7 is a hybrid of what
Scheme ought to be and what Common Lisp mostly is. There is
often an "apropos" or "help" function to check if something
is already defined.
_______________________________________________
Cmdist mailing list
[email protected]
https://cm-mail.stanford.edu/mailman/listinfo/cmdist