Home › Forums › kdb+ › May I know how this syntax work please? h".z.pg:{.Q.trp[(0;)@value@;x;{(1;.Q.sbt y)}]}" › Re: May I know how this syntax work please? h".z.pg:{.Q.trp[(0;)@value@;x;{(1;.Q.sbt y)}]}"
-
.Q.trp[(0;)@value@;x;{(1;.Q.sbt y)}]
means roughly the same as
.Q.trp[{(0;value x)};x;{(1;.Q.sbt y)}]
The only difference is that the second form uses a lambda, which appears as an additional level in the stack trace.
The @ at the end of an expression forces it to be a projection (since it’s a binary operator and we haven’t given it a right argument). But in order to compose this with the (0;) operation (which puts the result in the 2nd element of the list) we need to include another @ otherwise we would be composing the wrong functions.
.Q.trp[{value x};x;{(1;.Q.sbt y)}] works but it returns a different value in the success case (just the value instead of a list).