Subject: Re: increasing order lists.
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 13 Oct 2000 06:55:32 GMT
Newsgroups: comp.lang.scheme
Message-ID: <8s6bl4$8bejr$1@fido.engr.sgi.com>
Dowe Keller <dowe@krikkit.localdomain> wrote:
+---------------
| I'm no scheme wizard but it looks like your consing up a doted list.
| try:
| (define (only-numbers a-list)
|   (cond ((null? a-list) #nil) <- this should fix your problem
|         ((number? (car a-list))
|          (cons (car a-list) (only-numbers (cdr a-list))))
|         (else (only-numbers (cdr a-list)))))
+---------------

Close, but Scheme has no such "#nil" token. Use '() instead:

    (cond ((null? a-list) '()) ...)

Or the following equivalent oft-seen idiom:

    (cond ((null? a-list) a-list) ...)


-Rob

-----
Rob Warnock, 31-2-510		rpw3@sgi.com
Network Engineering		http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		PP-ASEL-IA
Mountain View, CA  94043