Dict:enlist[`]!enlist()!()
basically you need to stop the list of conforming dictionaries collapsing to a table
q)enlist a
b!1 2
a b
1 2
q)(a
b!1 2;a
b!3 4)
a b
1 2
3 4
q)d:()!()
q)d[`x]:`a`b!1 2
q)d
| a b
-| —
x| 1 2
and there’s a couple of ways to do that, but essentially you’re looking to keep a entry in the dict value that will stop the collapse (anything but a conforming dict)
q)d:enlist[::]!()
q)d[`x]:`a`b!1 2
q)d
::| ()
x|
a`b!1 2
Thanks for that.I ended up usingd:()!()d[x]:(1 2)!(3 4)@[
d;x;:;((enlist 1)!enlist
x))]As I didn’t want any other value left in the dictionary.I guess with your soln I could just have a final stepd:d[x]Thanks,NickOn Feb 9, 2:02?pm, Charles Skelton <char...> wrote:> basically you need to stop the list of conforming dictionaries collapsing to> a table>> q)enlist
ab!1 2> a b> ---> 1 2>> q)(
ab!1 2;
ab!3 4)> a b> ---> 1 2> 3 4>> q)d:()!()> q)d[
x]:a
b!1 2>> q)d> ?| a b> -| —> x| 1 2>> and there’s a couple of ways to do that, but essentially you’re looking to> keep a entry in the dict value that will stop the collapse (anything but a> conforming dict)>> q)d:enlist[::]!()> q)d[x]:
ab!1 2>> q)d> ::| ()>
x| a
b!1 2>> On Wed, Feb 9, 2011 at 2:44 PM, Charles Skelton <char…> wrote:> > Dict:enlist[]!enlist()!()>> > On Wed, Feb 9, 2011 at 1:15 PM, Nick <nickmcd...> wrote:>> >> Just seeing that Dict[
jim]:(ya
daya
da)!(4 5 6 3) is a bad example> >> of a dictionary with non unique keys..>> >> On Feb 9, 11:53 am, Nick <nickmcd…> wrote:> >> > Dict:()!()> >> > Dict[jim]:(
yada
yada)!(4 5 6 3)> >> > dict[
this]:(epic)!(
fail)> >> > type>> >> > I think it's failing due to a dict mapping lists and these are atoms>> >> > dict[
that]:(enlist epic)!(enlist
fail)> >> > type>> >> > anotherdict:(enlist
epic)!(enlist `notfail)> >> > works ok>> >> > It’s probably something stupid I’m missing so any input would be> >> > appreciated.>> >> > Thanks,>> >> > Nick>> >> –> >>
Submitted via Google Groups</nickmcd…></nickmcd…></char…></char…>