Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Hash-from-two-arrays/K/hash-from-two-arrays-1.k
Normal file
10
Task/Hash-from-two-arrays/K/hash-from-two-arrays-1.k
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
a: `zero `one `two / symbols
|
||||
b: 0 1 2
|
||||
|
||||
d:. a,'b / create the dictionary
|
||||
.((`zero;0;)
|
||||
(`one;1;)
|
||||
(`two;2;))
|
||||
|
||||
d[`one]
|
||||
1
|
||||
19
Task/Hash-from-two-arrays/K/hash-from-two-arrays-2.k
Normal file
19
Task/Hash-from-two-arrays/K/hash-from-two-arrays-2.k
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
keys: !10 / 0..9
|
||||
split:{1_'(&x=y)_ x:y,x}
|
||||
vals:split["zero one two three four five six seven eight nine";" "]
|
||||
|
||||
s:{`$$x} / convert to symbol
|
||||
d:. (s'keys),'s'vals
|
||||
.((`"0";`zero;)
|
||||
(`"1";`one;)
|
||||
(`"2";`two;)
|
||||
(`"3";`three;)
|
||||
(`"4";`four;)
|
||||
(`"5";`five;)
|
||||
(`"6";`six;)
|
||||
(`"7";`seven;)
|
||||
(`"8";`eight;)
|
||||
(`"9";`nine;))
|
||||
|
||||
$d[s 1] / leading "$" converts back to string
|
||||
"one"
|
||||
Loading…
Add table
Add a link
Reference in a new issue