Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# running this in irb in tmux on WSL on Windows 10 (then you have to ctrl-c) causes segfault
# ruby version ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
# /etc/lsb-release
#DISTRIB_ID=Ubuntu
#DISTRIB_RELEASE=16.04
#DISTRIB_CODENAME=xenial
#DISTRIB_DESCRIPTION="Ubuntu 16.04.5 LTS"
def gen(r); o = ->(n) { n == 1 ? 1 : r**(n-1) + r*(-> o {o[r**(n-1)]}[o])}; end
two = gen(2)
two[2]
two[1]
two[2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment