Date: Jan 16, 2013 11:07 PM
Author: Graham Cooper
Subject: Re: function arity > 2
On Jan 16, 7:55 pm, Butch Malahide <fred.gal...@gmail.com> wrote:

>

> Damned if I know. I've *heard* of lambda calculus, and that's about it.

It's a method to Run functions on the fly, that is how LISP works!

No need to define a function, just have nameless lambda expressions.

-\ x . x+1

this is succ(x)

( -\ x . x+1 ) 7

= 8

---------

f(x,y) = 2*x+y

-\ x,y . 2*x+y

( -\ x,y . 2*x+y ) 5 1

= 11

---------

or you can CURRY each argument one at a time..

-\ f . (-\ y . f+y)

This is a function that takes 1 parameter f

and returns a function f that also adds its parameter y

It does half the work!

----------

( -\ f . ( -\ y . f+y ) ) f*2 5 1

= 11

SOLVE THE OUTERMOST LAMBDA 1ST

[ (-\ f . (-\ y . f+y) ) y*2 ] 5 1

( -\ y . y*2 + y ) 5 1

...hmm nearly!

You can reduce any n parameter function down to a sequence of n high

order function applications of 1 parameter!

f (a,b)

<->

g(a) (b)

g is a high order function that inputs a,

and returns another function that inputs b

Herc

--

www.microPROLOG.com