Skip to content

Instantly share code, notes, and snippets.

@y-yu
Created October 15, 2023 17:02
Show Gist options
  • Save y-yu/c77e975a6ccbfc61ac731ce7d4b94f85 to your computer and use it in GitHub Desktop.
Save y-yu/c77e975a6ccbfc61ac731ce7d4b94f85 to your computer and use it in GitHub Desktop.
nextpair (@z ->) (-> @y) = @z -> unpair (fst:-> @f) (snd:-> copy (-> id ->:fst) (-> + @f ->:snd) pair -> @y)
next (@x ->) (-> @y) = nextpair (fib (@x - 1)) -> @y
fib (@x ->) (-> @y) = @x -> if (@x == 0 || @x == 1) (then:-> (1, 1) ->) (else:-> next ->) merge -> @y
:{
@x'0 -> fib -> unpair (fst:-> @t) (snd:-> output)
@x'0 + 1 -> @x
:}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment