;;; fizzbuzz.lsp — FizzBuzz from 1 to 100
;;; Run: python3 lumbda.py --fast examples/fizzbuzz.lsp

(define (fizzbuzz n)
  (let ((div3 (= (modulo n 3) 0))
        (div5 (= (modulo n 5) 0)))
    (cond
      ((and div3 div5) "FizzBuzz")
      (div3 "Fizz")
      (div5 "Buzz")
      (else (number->string n)))))

(define (run-fizzbuzz limit)
  (let loop ((i 1))
    (if (<= i limit)
      (begin
        (display (fizzbuzz i))
        (newline)
        (loop (+ i 1))))))

(run-fizzbuzz 100)
