Skip to content

Instantly share code, notes, and snippets.

@ParadoxV5
Created November 28, 2023 05:28
Show Gist options
  • Save ParadoxV5/292123d3b8c13202dac0003295668177 to your computer and use it in GitHub Desktop.
Save ParadoxV5/292123d3b8c13202dac0003295668177 to your computer and use it in GitHub Desktop.
Fibonacci calculator implemented with only `\W`s (and without realizing `Range%` is a block-taking thing)
$* << [//=~'', /$/=~'$'] << () << ->() {
$*[~(/$$/=~'$$')][
( $*[~(/$/=~'$')] += (/$/=~'$') ) - (/$/=~'$')
] ||= (
$*[~(/$/=~'$')] -= (/$$/=~'$$')
$*[~(//=~'')][] + $*[ ~(/$$/=~'$$') ][ $*[~(/$/=~'$')] - (/$$/=~'$$') ]
)
}
# Test
p 0x10.times.map {|n|
ARGV[-2] = n
ARGV[-1][] # lol
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment