Skip to content

Instantly share code, notes, and snippets.

@domgetter
Created January 1, 2019 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domgetter/8a15c843f60b772c2c7bd3a48d269d49 to your computer and use it in GitHub Desktop.
Save domgetter/8a15c843f60b772c2c7bd3a48d269d49 to your computer and use it in GitHub Desktop.
# 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