Hex Artifact Content
Not logged in

Artifact 8a19e45bd42355a9a6f710eb288eec0bb198e457:


0000: 64 65 66 20 66 69 62 28 78 29 0a 7b 0a 09 69 66  def fib(x).{..if
0010: 28 20 78 20 3c 20 32 20 29 20 7b 20 31 20 7d 0a  ( x < 2 ) { 1 }.
0020: 09 65 6c 73 65 20 20 20 20 20 20 20 20 7b 20 66  .else        { f
0030: 69 62 28 78 2d 31 29 20 2b 20 66 69 62 28 78 2d  ib(x-1) + fib(x-
0040: 32 29 20 7d 0a 7d 3b 0a 0a 6c 65 74 20 75 70 74  2) }.};..let upt
0050: 6f 20 3d 20 ce bb 28 6e 2c 20 66 29 7b 0a 09 69  o = ..(n, f){..i
0060: 66 28 20 6e 20 3e 20 30 20 29 7b 20 75 70 74 6f  f( n > 0 ){ upto
0070: 28 6e 2d 31 2c 66 29 20 7d 3b 0a 09 66 28 6e 29  (n-1,f) };..f(n)
0080: 0a 7d 3b 0a 0a 76 61 72 20 63 6f 6d 70 6f 73 65  .};..var compose
0090: 20 3d 20 66 75 6e 28 66 2c 67 29 7b 20 66 75 6e   = fun(f,g){ fun
00a0: 28 78 29 7b 66 28 67 28 78 29 29 7d 20 7d 3b 0a  (x){f(g(x))} };.
00b0: 76 61 72 20 22 3c 3c 22 20 3d 20 63 6f 6d 70 6f  var "<<" = compo
00c0: 73 65 3b 0a 0a 75 70 74 6f 28 31 36 2c 20 70 72  se;..upto(16, pr
00d0: 69 6e 74 3c 3c 66 69 62 29 3b 0a                 int<<fib);.