title | categories | |
---|---|---|
K dictionaries |
|
Creating a dict in K:
"abc"!!3
Single element dict
!/+(,("a";0))
Many verbs do "merge" on dicts.
d1:"abc"!0 1 2
d1
!/+(("a";0)
("b";1)
("c";2))
d2:"bcd"!2 1 0
d2
!/+(("b";2)
("c";1)
("d";0))
d1+d2
!/+(("a";0)
("b";3)
("c";3)
("d";0))
d1-d2
!/+(("a";0)
("b";-1)
("c";1)
("d";0))
d1&d2
!/+(("a";0N)
("b";1)
("c";1)
("d";0N))
d1|d2
!/+(("a";0)
("b";2)
("c";2)
("d";0))