456636700c
- Emitter: def registry (definedGlobals) for symbol emit distinction - Emitter: cond emits return statements - Emitter: reduce wraps named functions in closure adapter - Emitter: clojure.string/* function mappings (split, lower-case, etc.) - Emitter: statement detection for echo cljRepr wrapping - Runtime: cljGet supports default value (3 args) - Runtime: cljStrSplit supports regex patterns via re module - Examples: fizzbuzz.clj and wordfreq.clj both compile and run correctly - Tests: emit symbol / emit mangled symbol now pass (80/80) - Compliance: 233/233 (100%) maintained
14 lines
309 B
Clojure
14 lines
309 B
Clojure
; FizzBuzz — classic programming challenge
|
|
; Tests: cond, mod, map, range, str, println
|
|
|
|
(defn fizzbuzz [n]
|
|
(cond
|
|
(= (mod n 15) 0) "FizzBuzz"
|
|
(= (mod n 3) 0) "Fizz"
|
|
(= (mod n 5) 0) "Buzz"
|
|
:else (str n)))
|
|
|
|
(println "=== FizzBuzz 1-30 ===")
|
|
(doseq [i (range 1 31)]
|
|
(println (fizzbuzz i)))
|