Can someone clarify implicit composition here ?

https://learninghub.kx.com/forums/topic/can-someone-clarify-implicit-composition-here

https://code.kx.com/q/ref/compose/

The syntax does not make much sense

Hi @newstudent2017

In the documentation it states "the derived function '[f;ff] has the rank of ff and returns f ff[x;y;z]"

If we use the following examples:

q)ff:{[w;x;y;z]w+x+y+z}

q)ff[1;2;3;4]

10

If the syntax returns f ff[x;y;z] then essentially the result for ff[w;x;y;z] is our x parameter for f.

We know that ff[1;2;3;4] = 10

q)f:{2*x}

q)f[10]

20


We use composition to combine these steps together:

q)'[f;ff][1;2;3;4]

20


If you have any questions about this, please let me know!

Thanks,

Megan