scheme online interpreter
http://jscheme.sourceforge.net/jscheme/src/jlib/demo/Demorunner.html
try this:
(define (count lis ele)
(cond((null? lis) 0)
((eq? (car lis) ele) (+ 1 (count (cdr lis) ele)))
(else (count (cdr lis) ele)))
)
)
(count '(a b c d a a) 'a)
沒有留言:
張貼留言