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

automatic currying in scheme

Name: Anonymous 2008-11-23 23:19

is it possible without macros?

Name: Anonymous 2008-11-26 2:34

((+) 1 2 3) ≡ ((+ 1) 2 3) ≡ ((+ 1 2) 3) ≡ (+ 1 2 3) ≡ (((+) 1) 2 3) ≡ (((+ 1) 2) 3) ≡ ...

i suppose that would really be some kind of laziness...

Name: Anonymous 2008-11-26 12:45

(define (plus . args)
  (if (null? args)
      plus
      (lambda x
        (apply plus (append args x)))))


this, unfortunately, never returns a value, only more functions

Name: Anonymous 2008-11-26 17:06

>>26
Yes. Partial application is when you apply a function taking n arguments to only one argument, and get a function taking n-1 arguments rather than a syntax error. Automatic currying is an ungainly way of saying it. But it has nothing to do with laziness.

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