Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Fibs in your favourite language

Name: Anonymous 2008-12-20 15:04

fibs = 1 : zipWith (+) fibs (tail fibs)

Name: Anonymous 2008-12-21 2:36

>>48
here's a nice functional implementation of the Ackermann function for you, it shouldn't be too hard to translate into your toy language:
USING: kernel math arrays sequences ;
: ackermann ( m n -- r )
 over zero? [
  1+ nip
 ] [
  over 1 = [
   2 + nip
  ] [
   over 2 = [
    1 shift 3 + nip
   ] [
    over 3 = [
     3 + 1 swap shift 3 - nip
    ] [
     1+ swap 1- <array> 1 [ swap ackermann ] reduce
    ] if
   ] if
  ] if
 ] if
;

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List