Choose Language Hide Translation Bar
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?





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!
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:

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(...) }, ... )



Article Labels

    There are no labels assigned to this post.