summaryrefslogtreecommitdiff
path: root/test/colm.d/map6.lm
blob: 7261256ecc293c914df3d09e3136cfe4920cc834 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
new M: map<str, str>()

AE: list_el<str> = argv->head_el
while AE {
	M->insert( AE->value, toupper(AE->value) )
	AE = AE->next
}

for A: str in argv {
	new El: map_el<str, str>()

	El->key = toupper(A)
	El->value = A

	M->insert_el( El )
}

for El: map_el<str, str> in M {
	print "[El->key] [El->value]
}

El: map_el<str, str> = M->head_el
while ( El ) {
	print "[El->key] [El->value]
	El = El->next
}

###### ARGS ######
a b c done
###### EXP ######
A a
B b
C c
a A
b B
c C
DONE done
done DONE
A a
B b
C c
a A
b B
c C
DONE done
done DONE