codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
(define (iota count . start-step) (define (iota-loop count start step) (if (zero? count) '() (cons start (iota-loop (- count 1) (+ start step) step)))) (cond ((null? start-step) (iota-loop count 0 1)) ((null? (cdr start-step)) (iota-loop count (car start-step) 1)) (else (iota-loop count (car start-step) (cadr start-step))))) ; --------------------------------------------------------------------- (define (fizzbuzz n) (cond ((= (modulo n 3) (modulo n 5) 0) (display "FizzBuzz\n")) ((= (modulo n 3) 0) (display "Fizz\n")) ((= (modulo n 5) 0) (display "Buzz\n")) (else (display n) (display "\n")))) (for-each fizzbuzz (iota 100 1))
Private
[
?
]
Run code
Submit