update
This commit is contained in:
parent
1f1ad49427
commit
6f050a029e
2496 changed files with 37609 additions and 3031 deletions
|
|
@ -0,0 +1,66 @@
|
|||
void
|
||||
show_sublist(list l)
|
||||
{
|
||||
integer i;
|
||||
|
||||
i = 0;
|
||||
while (i < l_length(l)) {
|
||||
if (i) {
|
||||
o_space(1);
|
||||
}
|
||||
o_integer(l_q_integer(l, i));
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
show_list(list l)
|
||||
{
|
||||
integer i;
|
||||
|
||||
i = 0;
|
||||
while (i < l_length(l)) {
|
||||
o_text(" [");
|
||||
show_sublist(l_q_list(l, i));
|
||||
o_text("]");
|
||||
i += 1;
|
||||
}
|
||||
|
||||
o_byte('\n');
|
||||
}
|
||||
|
||||
list
|
||||
multiple_distinct(integer n, object o)
|
||||
{
|
||||
list l;
|
||||
|
||||
while (n) {
|
||||
l_append(l, o);
|
||||
n -= 1;
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
integer
|
||||
main(void)
|
||||
{
|
||||
list l, z;
|
||||
|
||||
# create a list of integers - `3' will serve as initializer
|
||||
l = multiple_distinct(8, 3);
|
||||
|
||||
l_clear(l);
|
||||
|
||||
# create a list of distinct lists - `z' will serve as initializer
|
||||
l_append(z, 4);
|
||||
l = multiple_distinct(8, z);
|
||||
|
||||
# modify one of the sublists
|
||||
l_r_integer(l_q_list(l, 3), 0, 7);
|
||||
|
||||
# display the list of lists
|
||||
show_list(l);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue