Choose Language Hide Translation Bar
Highlighted
vuxolinu
Level I

Function has 2 parameters but 0 were given

Hi everybody,

I am trying to pass a function to the local memory space of the Parallel Assign function

It does not work because JMP tells me F has 2 parameters but 0 were given. How can I fix this?

 

 

 

2 REPLIES 2
Highlighted

Re: Function has 2 parameters but 0 were given

JMP passes arguments to functions by value. If I specify an argument as a variable (e.g., the variable storing the user function that you defined), it won't work. For example,

 

Names Default to Here( 1 );

f1 = Function( { x }, 2*x );

f2 = Function( { f, x }, 2 * f( x ) );

f2( f1, 3 );

I get the same error.

 

I don't know what you are trying to do but it might work if you use expressions instead of user functions.

Learn it once, use it forever!
Highlighted
Craige_Hales
Staff (Retired)

Re: Function has 2 parameters but 0 were given

I'm answering a question that might or might not be the question you are asking: I think you've written something like this:

f=function(...);
parallel assign({ g = f }, ... )

which will try to evaluate the right hand side of g=f and produce the error you mention.

Something like this will work:

parallel assign( { g = function(...) }, ... )

see https://community.jmp.com/t5/Discussions/How-to-pass-a-function-to-Parallel-Assign/m-p/230728 

 

Craige
Article Labels

    There are no labels assigned to this post.