Skip to content

Instantly share code, notes, and snippets.

@kohyama
Last active August 29, 2015 13:58
Show Gist options
  • Save kohyama/10346936 to your computer and use it in GitHub Desktop.
Save kohyama/10346936 to your computer and use it in GitHub Desktop.

Revisions

  1. kohyama revised this gist Apr 10, 2014. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion fibbuzz.clj
    Original file line number Diff line number Diff line change
    @@ -7,4 +7,7 @@
    3 "Fizz"
    x))

    (def fibbuzz-seq (map fizzbuzz (fibs 1 1)))
    (def fibbuzz-seq (map fizzbuzz (fibs 1 1)))

    ; (take 100 fibbuzz-seq)
    ; -> (1 1 2 "Fizz" "Buzz" 8 13 "Fizz" ... 218922995834555169026N "FizzBuzz")
  2. kohyama revised this gist Apr 10, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion fibbuzz.clj
    Original file line number Diff line number Diff line change
    @@ -7,4 +7,4 @@
    3 "Fizz"
    x))

    (def fibbuzz-seq (map fizzbuzz (fibs 1N 1N)))
    (def fibbuzz-seq (map fizzbuzz (fibs 1 1)))
  3. kohyama revised this gist Apr 10, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion fibbuzz.clj
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    (defn fibs [a b] (cons a (lazy-seq (fibs b (+ a b)))))
    (defn fibs [a b] (cons a (lazy-seq (fibs b (+' a b)))))

    (defn fizzbuzz [x]
    (condp #(zero? (mod %2 %1)) x
  4. kohyama revised this gist Apr 10, 2014. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions fibbuzz.clj
    Original file line number Diff line number Diff line change
    @@ -7,5 +7,4 @@
    3 "Fizz"
    x))

    (def fibbuzz-seq
    (map fizzbuzz (fibs 1N 1)))
    (def fibbuzz-seq (map fizzbuzz (fibs 1N 1N)))
  5. kohyama created this gist Apr 10, 2014.
    11 changes: 11 additions & 0 deletions fibbuzz.clj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    (defn fibs [a b] (cons a (lazy-seq (fibs b (+ a b)))))

    (defn fizzbuzz [x]
    (condp #(zero? (mod %2 %1)) x
    15 "FizzBuzz"
    5 "Buzz"
    3 "Fizz"
    x))

    (def fibbuzz-seq
    (map fizzbuzz (fibs 1N 1)))