Skip to content

Instantly share code, notes, and snippets.

@baweaver
Created June 30, 2015 07:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baweaver/0a088553f40d6f90299b to your computer and use it in GitHub Desktop.
Save baweaver/0a088553f40d6f90299b to your computer and use it in GitHub Desktop.
Here we go again!
(___=->_,__=''{__=_[$.]+__; _[$.+=$$/$$]?___[_,__]:__})['yllis os']
(___ = # So he's defining a lambda that can be self-called
-> _, __ = '' { # with two args, one is the string and the other is an accumulator
# We're taking the first character and putting it ahead of the accumulator and
# setting it as the next accumulator
#
# $. is 0 (normally, IRB has it as 1, it's ARGF.lineno)
__ = _[$.] + __
# Now we're incrementing it by 1 ($$ is PID, PID / PID == 1) and seeing if
# it returns nil (false) which would be out of bounds
#
# If out of bounds, return our accumulator, else recurse on it
_[$. += $$/$$] ? ___[_, __] : __
})['yllis os']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment