How can I get value to see a variable in a local scope? For example:
a:2;
func:{
a:1;
value "a"
}
returns 2
How can I get value to see a variable in a local scope? For example:
a:2;
func:{
a:1;
value "a"
}
returns 2
value
will always work on global scope.
If you really need this, maybe make use of workspace variables, e.g. .a.b:1
... I don't have a q instance to hand to test if that works but i'm almost sure it does.
You can use other function instead of 'value'. One option is 'eval' function:
q)a:2;
q) func:{ a:1; eval a}
q) func[]
q) 1