Do anyone know tutorials about partially parameterized function

implementation? Currently I evaluate curry function and get an

expression as result(contains variables) then the function apply to

parameters, evaluated the the expression by replacing variable with

actual parameters.

Robert> experts, I think it is good virtue to help a beginner!

Google for "Xavier Leroy" "ZINC"

--

A true pessimist won't be discouraged by a little success.

If I am understanding you right, I think a few examples might help in

providing motivation for using partially parameterized functions at

least, and really show that there is not much mystery... I mean after

all you are just NOT supplying a parameter or maybe two..

Anyway here is a function f that is then encapsulated in the function

g with one parameter missing... then g is mapped over a list providing

the missing parameter from the elements of the list and building and

producing the list of the results of the function application as the

result.

Prelude> let f a b = a^b

Prelude> let g = f 2

Prelude> map g [2..7]

[4,8,16,32,64,128]

if you wanted to get the results instead of 2 raised to the incremental

powers from 2 to 7 then ... you could change the definition of function

g to be :

Prelude> let g = (flip f) 2

Prelude> map g [2..7]

[4,9,16,25,36,49]

These is an overly simple example but it might help ... I hope.

gene

providing motivation for using partially parameterized functions at

least, and really show that there is not much mystery... I mean after

all you are just NOT supplying a parameter or maybe two..

Anyway here is a function f that is then encapsulated in the function

g with one parameter missing... then g is mapped over a list providing

the missing parameter from the elements of the list and building and

producing the list of the results of the function application as the

result.

Prelude> let f a b = a^b

Prelude> let g = f 2

Prelude> map g [2..7]

[4,8,16,32,64,128]

if you wanted to get the results instead of 2 raised to the incremental

powers from 2 to 7 then ... you could change the definition of function

g to be :

Prelude> let g = (flip f) 2

Prelude> map g [2..7]

[4,9,16,25,36,49]

These is an overly simple example but it might help ... I hope.

gene

Just as a follow up although this is bearing on another topic, that of

use of anonymous lambda functions.. it almost always makes more sense

not to muck up things like I did in the example above..

and given the function:

f a b = a^b

to apply (f a) or (flip f a) directly rather than naming another

function.. for use in one spot such as the mapping in the example. So:

Prelude> map ((flip f) 2) [1..12]

[1,4,9,16,25,36,49,64,81,100,121,144]

gene

use of anonymous lambda functions.. it almost always makes more sense

not to muck up things like I did in the example above..

and given the function:

f a b = a^b

to apply (f a) or (flip f a) directly rather than naming another

function.. for use in one spot such as the mapping in the example. So:

Prelude> map ((flip f) 2) [1..12]

[1,4,9,16,25,36,49,64,81,100,121,144]

gene

1. curried and uncurried functions

2. [Haskell] curried and uncurried functions

5. [Fwd: [PHP] Bind function parameters with create_function ('currying')]

6. Curried functions in JavaScript (how to employ genericly, and invisibly)?

8. Function Application is not Currying

9. A simple question about the dotted pair as an argument in a curry function

10. Bind function parameters with create_function ('currying')

11. Function Application is not Currying

12. Function adapters, currying: how to build a generalized binder?

5 post • Page:**1** of **1**