Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,7 @@
|
|||
proc multilist {value args} {
|
||||
set res $value
|
||||
foreach dim [lreverse $args] {
|
||||
set res [lrepeat $dim $res]
|
||||
}
|
||||
return $res
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
% multilist x 2
|
||||
x x
|
||||
% multilist x 2 3
|
||||
{x x x} {x x x}
|
||||
% multilist x 2 3 4
|
||||
{{x x x x} {x x x x} {x x x x}} {{x x x x} {x x x x} {x x x x}}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
% set ml [multilist 0 2 3 4]
|
||||
{{0 0 0 0} {0 0 0 0} {0 0 0 0}} {{0 0 0 0} {0 0 0 0} {0 0 0 0}}
|
||||
% lset ml 1 2 3 11
|
||||
{{0 0 0 0} {0 0 0 0} {0 0 0 0}} {{0 0 0 0} {0 0 0 0} {0 0 0 11}}
|
||||
% lset ml 1 1 4 12
|
||||
{{0 0 0 0} {0 0 0 0} {0 0 0 0}} {{0 0 0 0} {0 0 0 0 12} {0 0 0 11}}
|
||||
% lindex $ml 1 2 3
|
||||
11
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
% array set x {
|
||||
0,0 a
|
||||
0,1 b
|
||||
1,0 c
|
||||
1,1 d
|
||||
}
|
||||
% parray x
|
||||
x(0,0) = a
|
||||
x(0,1) = b
|
||||
x(1,0) = c
|
||||
x(1,1) = d
|
||||
% puts $x(0,1)
|
||||
b
|
||||
% set a 0
|
||||
1
|
||||
% set b 1
|
||||
% puts $x($b,$a)
|
||||
c
|
||||
% set $x($b,$a) "not c"
|
||||
not c
|
||||
% parray x $b,$a
|
||||
x(1,0) = not c
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
% array get x 1,*
|
||||
1,0 c 1,1 d
|
||||
% array names x 0,*
|
||||
0,0 0,1
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
% array set players {
|
||||
1,name Fido
|
||||
1,score 0
|
||||
1,colour green
|
||||
|
||||
2,name Scratchy
|
||||
2,score 99
|
||||
2,colour pink
|
||||
}
|
||||
% foreach player {1 2} {
|
||||
puts "$players($player,name) is $players($player,colour) and has $players($player,score) points"
|
||||
}
|
||||
Fido is green and has 0 points
|
||||
Scratchy is pink and has 99 points
|
||||
%
|
||||
Loading…
Add table
Add a link
Reference in a new issue