| From: SamuelXiao (foolsmart2005 at gmail.com) Date: Mon Nov 24 01:50:00 EST 2008 |
|
I have following code:
(define (mysum list)
(if (null? list)
0
(+ (car list) (mysum (cdr list)))
)
)
It can handle the case summing up a list of numbers....however, I want
to handle case like '(1 (2 3) 4), how can I make it?
The code can handle (mysum '(1 2 3)) => 6, but when it comes to (mysum
'(1 (2 3) 4))=>error. Any help would be appreciated.
| Posted on the users mailing list. |
|