I learned from here that
[...] in a parse tree a variable is represented by a symbol containing its name. Thus to distinguish a symbol or a list of symbols from a variable it is necessary to enlist that expression.
Given that, why does below expression evaluate to (enlist;`a;`b)
instead of just `a`b
?
Asking because it seems enlist[`a;`b]~`a`b
is true.
q)parse"(a;b)"
enlist
`a
`b
I don't think you would ever want a parse tree to collapse two same-type values into a single uniform list, it would break the ability to eval
the parse tree, e.g
q)a:1
q)b:1
q)
q)eval parse"(a;b)"
1 1
q)eval `a`b
'type
[0] eval `a`b
^
And secondly, (enlist;`a;`b)
isn't the same as enlist[`a;`b]
however the value
of (enlist;`a;`b)
is:
q)value[(enlist;`a;`b)]~enlist[`a;`b]
1b
So I guess it comes down to the nuanced differences between eval
and value