mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-07 15:28:49 +00:00
More stdlib; fixed another bug in higher-order functions
This commit is contained in:
parent
2594f7a8dc
commit
5dcc3a97b0
5 changed files with 469 additions and 457 deletions
|
|
@ -1,23 +1,33 @@
|
|||
import Collection;
|
||||
|
||||
local tree = {}, i;
|
||||
local s = emptySet (), i;
|
||||
|
||||
for i := 100, i >= 1, i := i-1 do
|
||||
tree := insert (tree, i, i);
|
||||
printf ("Inserting: %s\n", i.string);
|
||||
printf ("Result : %s\n", tree.string)
|
||||
for i := 0, i < 100, i := i+1
|
||||
do
|
||||
s := addSet (s, i);
|
||||
validateColl (s)
|
||||
od;
|
||||
|
||||
tree := {};
|
||||
printf ("Set internal structure: %s\n", s.string);
|
||||
printf ("Set elements: %s\n", elements (s).string);
|
||||
|
||||
for i := 1, i <= 100, i := i+2 do
|
||||
tree := insert (tree, i, i);
|
||||
printf ("Inserting: %s\n", i.string);
|
||||
printf ("Result : %s\n", tree.string)
|
||||
for i := 0, i < 100, i := i+1
|
||||
do
|
||||
printf ("Testing %-3d => %d\n", i, memSet (s, i));
|
||||
printf ("Testing %-3d => %d\n", i+100, memSet (s, i+100))
|
||||
od;
|
||||
|
||||
for i := 2, i <= 100, i := i+2 do
|
||||
tree := insert (tree, i, i);
|
||||
printf ("Inserting: %s\n", i.string);
|
||||
printf ("Result : %s\n", tree.string)
|
||||
od
|
||||
for i := 50, i < 150, i := i+1
|
||||
do
|
||||
s := removeSet (s, i);
|
||||
validateColl (s)
|
||||
od;
|
||||
|
||||
printf ("Set internal structure: %s\n", s.string);
|
||||
printf ("Set elements: %s\n", elements (s).string);
|
||||
|
||||
for i := 0, i < 100, i := i+1
|
||||
do
|
||||
printf ("Testing %-3d => %d\n", i, memSet (s, i))
|
||||
od
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue