开发者

Translating a Lambda Expression into Scheme

开发者 https://www.devze.com 2023-04-05 12:58 出处:网络
I 开发者_JAVA百科have this lambda lambda expression : λx.(λy.(λz.x(yz))) I\'m trying to write a Scheme expression out of it.

I 开发者_JAVA百科have this lambda lambda expression : λx.(λy.(λz.x(yz)))

I'm trying to write a Scheme expression out of it.

I did this:

(define (f x)(lambda(y z) (f (y z))))

Is that right? If not, what am I doing wrong?


I'm not quite sure about that lambda notation but I think you need this:

(define (f x) (lambda (y) (lambda (z) (x (y z)))))

and you can use it like this:

(((f sqrt) 1+) 3)
2.0
0

精彩评论

暂无评论...
验证码 换一张
取 消