Skip to content

Latest commit

 

History

History
51 lines (45 loc) · 518 Bytes

2023-12-07-kdicts.md

File metadata and controls

51 lines (45 loc) · 518 Bytes
title categories
K dictionaries
apljk

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))