With the following:
q)t:([] e:1 2 3 4 5 6; a:0 0 1 2 3 4; b: 1 2 0 0 3 4; c:1 2 3 4 0 1)
q)t
e a b c
-------
1 0 1 1
2 0 2 2
3 1 0 3
4 2 0 4
5 3 3 0
6 4 4 1
q)colist: `a`b`c
q)colist
`a`b`c
Functional select using value
:
q)?[`t; enlist(any;(enlist,value (each;{(=;x;0)};colist))); 0b; ()]
e a b c
-------
1 0 1 1
2 0 2 2
3 1 0 3
4 2 0 4
5 3 3 0
value
select fails with symbolic version of colist
:
q)?[`t; enlist(any;(enlist,value (each;{(=;x;0)};`colist))); 0b; ()]
'type
[0] ?[`t; enlist(any;(enlist,value (each;{(=;x;0)};`colist))); 0b; ()]
^
eval
version of query works with symbolic version of colist
:
q)?[`t; enlist(any;(enlist,eval (each;{(=;x;0)};`colist))); 0b; ()]
e a b c
-------
1 0 1 1
2 0 2 2
3 1 0 3
4 2 0 4
5 3 3 0
But the non-symbolic version of colist
fails with eval
:
q)?[`t; enlist(any;(enlist,eval (each;{(=;x;0)};colist))); 0b; ()]
'c
[0] ?[`t; enlist(any;(enlist,eval (each;{(=;x;0)};colist))); 0b; ()]
^
The k
version of each
, k){x'y}
, works in quotes with value
:
q)?[`t; enlist(any;(enlist,value ("k){x'y}";{(=;x;0)};colist))); 0b; ()]
e a b c
-------
1 0 1 1
2 0 2 2
3 1 0 3
4 2 0 4
5 3 3 0
But not with the eval
version:
q)?[`t; enlist(any;(enlist,eval ("k){x'y}";{(=;x;0)};`colist))); 0b; ()]
'type
[0] ?[`t; enlist(any;(enlist,eval ("k){x'y}";{(=;x;0)};`colist))); 0b; ()]
^
Functional query generall doesn’t work without the value
or eval
:
q)?[`t; enlist(any;(enlist,(each; {(=;x;0)};`colist))); 0b; ()]
'type
[0] ?[`t; enlist(any;(enlist,(each; {(=;x;0)};`colist))); 0b; ()]
^
q)?[`t; enlist(any;(enlist,(each; {(=;x;0)};colist))); 0b; ()]
'type
[0] ?[`t; enlist(any;(enlist,(each; {(=;x;0)};colist))); 0b; ()]
^
q)?[`t; enlist(any;(enlist,("k){x'y}"; {(=;x;0)};`colist))); 0b; ()]
'type
[0] ?[`t; enlist(any;(enlist,("k){x'y}"; {(=;x;0)};`colist))); 0b; ()]
^
q)?[`t; enlist(any;(enlist,("k){x'y}"; {(=;x;0)};colist))); 0b; ()]
'type
[0] ?[`t; enlist(any;(enlist,("k){x'y}"; {(=;x;0)};colist))); 0b; ()]
^
- Why does the
value
version of the functional select require the non-symbolic version ofcolist
, whereas theeval
version does? - How does one include the
k
version ofeach
k){x'y}
in the eval version of the functional select? - Is there a way to get the functional query to work whic doesn’t require
value
oreval
?