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

proof that lisp is a toy language

Name: Anonymous 2007-10-25 9:25

it can't even do this:
function fib(n){
 return (function(i){
   return i==1?0:arguments.callee(i-1)+(function(i){
    return i==1?1:arguments.callee.caller(i-1)
   })(i-1)
  })(n+1)
}

Name: Anonymous 2007-10-25 10:02

Learn to Y combinator.

(define (fib n)
  ((lambda (f n)
     (cond ((= n 0) 0)
           ((= n 1) 1)
           (else (+ (f f (- n 1)) (f f (- n 2))))))
   (lambda (f n)
     (cond ((= n 0) 0)
           ((= n 1) 1)
           (else (+ (f f (- n 1)) (f f (- n 2))))))
   n))

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