Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as text by dennis ( 18 years ago )
(define (fizzbuzz n)
  (cond ((zero? (remainder n 15)) 'fizzbuzz)
        ((zero? (remainder n 3)) 'fizz)	;comment
	((zero? (remainder n 5)) 'buzz)
	(else n)))

(define (range n limit acc)
  (if (> n limit)
      (reverse acc)
      (range (+ 1 n) limit (cons n acc))))

;(map fizzbuzz (range 1 100 (list)))

;; or...

(define (fb start end proc)
  (cond ((> start end))
	(else (display (fizzbuzz start))
	      (newline)
	      (proc start)
	      (fb (+ 1 start) end proc))))

 

Revise this Paste

Your Name: Code Language: