You are getting length error because you are passing 1 value for ‘id’ field and 3 values for ‘symbols’ field.
Just enlist your symbol list and it will work fine.
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}span.s1 {font-variant-ligatures: no-common-ligatures}
q)t:([id:`int$()] symbols:());
1) t insert (1;enlist
ab
c)
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}span.s1 {font-variant-ligatures: no-common-ligatures}
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}span.s1 {font-variant-ligatures: no-common-ligatures}
id| symbols
–| -------
1 | a b c
q) meta t
c | t f a
-------| -----
id | i
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}span.s1 {font-variant-ligatures: no-common-ligatures}
symbols| S
On Friday, 2 November 2018 12:11:17 UTC, Osvaldo Fuica wrote:
Hi there,
I am trying to define a keyed table with a list of symbols.
So I started with automatic type definition. ()
t:([id:
int$()] symbols:());`
meta tc | t f a-------| -----id | isymbols|
t insert(1;a
bc)'length [0]
t insert (1;a
bc)
So, removing the key id the insert works and the symbols “S” type is defined as expected.
t:0!t;
t insert (1;a
bc)t:1!t;tid| symbols--| -------1 | a b cmeta tc | t f a-------| -----id | isymbols| S
I tried to define it directly.
t: 1!flip
idsymbols!"iS"$\:();meta t;c | t f a-------| -----id | isymbols| s
t insert (1;a
bc)'type [0]
t insert (1;a
bc)
Of course “S”$() and “s”$() both correspond to a `symbol$().
I would like defining directly a keyed table with a list of symbols without alter unkeyed/keyed definition in the first insertion.
Is there a way to do that in q ?
Thanks.
Osvaldo