Scan syntax for functions of the form y+a*x

It appears that for functions of the form f:{y+a*x} where a is a float, there is an abbreviated syntax for the scan f:

q){y+2*x}\[3;1 10 100 1000]7 24 148 1296q)2.0\[3;1 10 100 1000]7 24 148 1296fq)type(2.0\)108h

Curiously, the same trick does not appear to work for the over f/:

q){y+2*x}/[3;1 10 100 1000]1296q)2.0/[3;1 10 100 1000]'type [0] 2.0/[3;1 10 100 1000] ^q)type(2.0/)107h

Can anyone explain why 2.0\ is treated as {y+2*x}, or point to any help pages on the topic, beyond https://code.kx.com/q/ref/adverbs/#converge-iterate ?

Hi,

As of version 3.1 of KDB, the scan adverb has a the built in function for {{z+y*x}[x;y;z]}. The alternative syntax for this function is {x y\z}, i.e:

q){x y\z}[3.0;2.0;1 10 100 1000]

7 24 148 1296f

According to the KX site, this built-in function will only work with floats, however there is no record of a similar function being built into the over adverb presently.

Here is the link to the page containing info on this alternative syntax:

https://code.kx.com/q/ref/adverbs/#alternative-syntax

I hope this is of some help.

Regards,

Sam McGinn

AquaQ Analytics

Thanks for your response. Rephrasing it in the notation I was using, we have that, in addition to the syntax 2.0\ that I was asking about, there is yet another alternative syntax for {y+2*x}, namely, {x 2.0\y}:

q){x 2.0\y}[3.0;1 10 100 1000]
7 24 148 1296f

This is interesting but still does not explain the syntax 2.0\ which appears to be equivalent to both {y+2*x}\ and {x 2.0\y}.

It is equivalent.

Note that {x y\z}[;2.0;] is equivalent to {x 2.0\y}.