Skip to content

Instantly share code, notes, and snippets.

@algernon algernon/fizzbuzz.hy
Last active Dec 15, 2015

What would you like to do?
FizzBuzz in Hy
#! bin/hy
; -*- mode: lisp; mode: paredit -*-
(import fizzbuzz-macros)
(defn fizzbuzz [n]
(let [[result ""]]
(if (zero? (% n 3))
(setv result (+ result "fizz")))
(if (zero? (% n 5))
(setv result (+ result "buzz")))
(if (and (not (zero? (% n 3))) (not (zero? (% n 5))))
(setv result (str n)))
(print (map fizzbuzz (range 1 16)))
from hy.macros import macro
from hy.models.expression import HyExpression
from hy.models.symbol import HySymbol
from hy.models.integer import HyInteger
def zerop(tree):
expr = tree.pop(0)
return HyExpression([HySymbol('='),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.