Skip to content

Instantly share code, notes, and snippets.

@bradhe
Created March 7, 2014 00:26
Show Gist options
  • Select an option

  • Save bradhe/9402636 to your computer and use it in GitHub Desktop.

Select an option

Save bradhe/9402636 to your computer and use it in GitHub Desktop.
Nope.
_ = $$ / $$ # 1
__ = _ - _ # 0
@_ = _ + _ # 2
$_ = @_ + _ # 3
$- = @_ + $_ # 5
$-_ = $- * $_ # 15
@__ = '' << $-_ * ($- + $_) + @_ # z
$___ = '' << $-_ * $- - $- << $-_ * ($- + @_) << @__ << @__ # Fizz
@___ = '' << $-_ * $- - $_ * $_ << $-_ * ($- + $_) - $_ << @__ << @__ # Buzz
(___ = -> { # the fizzbuzz lambda
$. += _ # increment n
$> << ($. % $-_ == __ ? $___ + @___ # "FizzBuzz" if mod-15
: $. % $_ == __ ? $___ # "Fizz" for 3
: $. % $- == __ ? @___ # "Buzz" for 5
: $.) << # Otherwise, n
('' << $- * @_) # and a newline
$. < ($- * @_) ** @_ ? ___[] : _ # Check n against 100
})[] # Immediately invoke the lambda.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment