Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.