2022.03.15 02:35 PM
I'm wondering what this part of the line, it is a conditional does: not min(`time`sym~2#key flip value@)each t
In particular why there is an @ Appy here?
2022.03.15 03:22 PM - edited 2022.03.16 04:08 AM
It's creating a unary projection / composition for the part in brackets, could achieve the same with a lamda function:
q)(`time`sym~2#key flip value@)
~[`time`sym]#[2]!+@[.:]
q)(`time`sym~2#key flip value@) each t
110b
q){`time`sym~2#key flip value x} each t
110b
* there is an overhead with using lambdas so in tick it's preferred to be as efficient as possible
2022.03.16 04:01 AM
Where u
, v
, w
, etc. are unaries then u v w@
is a unary composition equivalent to {u v w x}
.
In this case two of the five unaries are projections. A little spacing clarifies:
(`time`sym~ 2# key flip value@) each t
2022.03.15 03:22 PM - edited 2022.03.16 04:08 AM
It's creating a unary projection / composition for the part in brackets, could achieve the same with a lamda function:
q)(`time`sym~2#key flip value@)
~[`time`sym]#[2]!+@[.:]
q)(`time`sym~2#key flip value@) each t
110b
q){`time`sym~2#key flip value x} each t
110b
* there is an overhead with using lambdas so in tick it's preferred to be as efficient as possible
2022.03.16 04:01 AM
Where u
, v
, w
, etc. are unaries then u v w@
is a unary composition equivalent to {u v w x}
.
In this case two of the five unaries are projections. A little spacing clarifies:
(`time`sym~ 2# key flip value@) each t
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.