2022.08.18 04:55 AM
hi, on a .q file, how can I set the namespace (e.g. ns), so that I do not have to specific the namespace every time when defining a function?
Instead of:
.ns.fn1:{}
.ns.fn2:{}
Can we have something like:
(set namespace ns)
fn1:{}
fn2:{}
2022.08.18 04:59 AM
Yes this can be done as follows
// Move into namespace
\d .ns
fn1:{}
fn2:{}
// Move out of namespace
\d .
2022.08.18 04:59 AM
Yes this can be done as follows
// Move into namespace
\d .ns
fn1:{}
fn2:{}
// Move out of namespace
\d .
2022.08.18 04:59 AM - edited 2022.08.22 07:01 PM
Yes, this is possible using the system command "d". See here for more info: https://code.kx.com/q/basics/syscmds/#d-directory
q)\d .ns
q.ns)fn1:fn2:{}
q)\d .
q).ns
| ::
fn2| {}
fn1| {}
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.