I'm having this simple piece of code, constructing a list of numbers:
#lang scheme
(define pseudofizzbuzz (lambda (x)
(cond
((zero? x) (quote ()))
((or (integer? (/ x 3)) (integer? (/ x 5))) (cons (quote ()) (pseudofizzbuzz (- x 1))))
(else (cons x (pseudofizzbuzz (- x 1)))))))
(define reverselist (lambda (lat)
(cond
((null? lat) (quote ()))
(else
(cons (reverselist (cdr lat)) (list (car lat)))))))
(reverselist (pseudofizzbuzz 10))
And the result I get is:
((((((((((() 1) 2) ()) 4) ()) ()) 7) 8) ()) ())
But what I want of course is:
(1 2 4 7 8)
Is there any way to do it in scheme? I'm using DrRacket.