0

How could it be an equality of manually created parse tree and the result of parse operation:

q)t:([]date:.z.d+til 5;ccy:5#`EUR`CAN`AUS;fx:5?(1.0 0.1))
q)@[;`date;1+]t
date       ccy fx
------------------
2020.11.01 EUR 0.1
2020.11.02 CAN 1
2020.11.03 AUS 0.1
2020.11.04 EUR 1
2020.11.05 CAN 0.1
q)parse"@[;`date;1+]t"
(@;::;,`date;(+;1))
`t
q)eval parse"@[;`date;1+]t"
date       ccy fx
------------------
2020.11.01 EUR 0.1
2020.11.02 CAN 1
2020.11.03 AUS 0.1
2020.11.04 EUR 1
2020.11.05 CAN 0.1
q)((@;::;(),`date;(+;1));`t) ~ parse"@[;`date;1+]t"
1b
q)eval ((@;::;(),`date;(+;1));`t)
'date
  [0]  eval ((@;::;(),`date;(+;1));`t)
       ^

and the inability to evaluate the same expression via eval?

I think I'm missing something, but what?


Upd: Is this approach correct?:

eval over ((@;;(),`date;(+;1));`t)
egor7
  • 4,678
  • 7
  • 31
  • 55

1 Answers1

1

The placeholder in the projection just happens to have type 101h (same as identity) but internally they are different

q)type(parse"+[;2]")1
101h
q)type(parse"+[::;2]")1
101h
q)
q)null(parse"+[::;2]")1
1b
q)null(parse"+[;2]")1
0b

In your case of a single elided item, I would resolve the projection using value or apply & then evaluate the parse tree

q)value((@;;(),`date;(+;1));`t)
@
`t
,`date
(+;1)
q)
q)(@).((@;;(),`date;(+;1));`t)
@
`t
,`date
(+;1)
jasonfealy
  • 1,081
  • 3
  • 5