0

Given functions:

f:{[par1; par2]
    :123;};

f_wrapper:{[par1; par2]
    :.[{f[x, y]};(par1;par2);456];};    

I am running:

f[1;2]
f_wrapper[1;2]

The first call returns 123 as expected. From the second call I am only getting a projection without f function being executed. I am expecting to receive 123 from the

Thomas Smyth - Treliant
  • 4,993
  • 6
  • 25
  • 36
user1217406
  • 329
  • 3
  • 15

1 Answers1

1

There's a typo in f_wrapper. It should be:

f_wrapper:{[par1; par2]
    :.[{f[x;y]};(par1;par2);456];}; 

You don't need to explitly pass the params as you are doing. Also the semi colon and the return at the end of you functions are overkill. Something like this works and is easier to read:

f:{[par1; par2]123};
f_wrapper:{[par1; par2]
    .[f;(par1;par2);456]} 
user1895961
  • 1,176
  • 9
  • 22
  • It seems that the ".[f;(par1;par2);456]" only works without ";" at the end (i.e. .[f;(par1;par2);456;]). Why is that ? – user1217406 Jan 05 '16 at 16:29
  • have a look [here](http://code.kx.com/wiki/JB:QforMortals2/functions#Functional_Forms_of_Amend). Basically you're forming a projection as you are calling it with 4 parameters, even though the last is blank. – user1895961 Jan 05 '16 at 16:42