In q, say someone was naughty and created a function that sometimes returns a table with a mixed-type column:
t:([] c1:(`a;"dfdf";`b;"ccvcv"))
and sometimes a table with a symbol-only column:
t:([] c1:`a`dfdf`b`ccvcv)
I want to update c1
to contain only symbols in a try-catch in case t
c1` already contains only symbols. But I have a hard time translating the statement
update c1:`$c1 from t where 10h=type each c1
into the ![t;c;b;a]
syntax which works with the try-catch @
operator
t:([] c1:(`a;"dfdf";`b;"ccvcv"));
c:enlist(=;type each `c1;10h);
b:0b;
a:(enlist`c1)!(enlist `$`c1); / TYPE ERROR
@[![;c;b;a];t;`continue] / this is what I want to do
Thanks for the help