Created
October 10, 2011 00:33
-
-
Save ympbyc/1274416 to your computer and use it in GitHub Desktop.
["simple answer for fizzbuzz writtern in JSLisp", "and the jscode code generated by the translator"]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define fizzbuzz (lambda (i) | |
(if (== i 101) | |
"" | |
(if (== (% i 15) 0) | |
(+ "fizzbuzz," (fizzbuzz (+ i 1))) | |
(if (== (% i 3) 0) | |
(+ "fizz," (fizzbuzz (+ i 1))) | |
(if (== (% i 5) 0) | |
(+ "buzz," (fizzbuzz (+ i 1))) | |
(+ (+ (String i) ",") (fizzbuzz (+ i 1)))) | |
))))) | |
(fizzbuzz 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fizzbuzz = function (i){ | |
return (i == 101) ? "" : ((i % 15) == 0) ? ("fizzbuzz," + (fizzbuzz)((i + 1))) : ((i % 3) == 0) ? ("fizz," + (fizzbuzz)((i + 1))) : ((i % 5) == 0) ? ("buzz," + (fizzbuzz)((i + 1))) : (((String)(i) + ",") + (fizzbuzz)((i + 1)))}; | |
(fizzbuzz)(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment