How can I write code using FP

Dan Bishop danb_83 at yahoo.com
Tue Jan 16 23:05:36 EST 2007


On Jan 16, 9:18 pm, "kernel1983" <kernel1... at gmail.com> wrote:
> In Function Program,Language can use like this:
>
> define a function:
> f = lambda x,y:x,y
>
> then we use f to define another function:
> f2 = f(1)
> the f2 should equal to:
> f2=lambda y:1,y
>
> we should be able call f2 with one parameter:f2(2)
> just return 1,2
>
> but how can I implement the characteristic in Python??I think it could
> do like this but HOW-TO?
>
> thanks~~~
> I'm a English beginner!
> I wish somebody understand my meaning

If I understand correctly, you can do:

f = lambda x, y: (x, y)
f2 = lambda y: f(1, y)




More information about the Python-list mailing list