mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-29 01:58:48 +00:00
Hash table
This commit is contained in:
parent
46dfd58bda
commit
149984f5c0
14 changed files with 258 additions and 21 deletions
22
stdlib/regression/test05.expr
Normal file
22
stdlib/regression/test05.expr
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import Collection;
|
||||
|
||||
fun f (x, y) {
|
||||
fun () {x+y}
|
||||
}
|
||||
|
||||
local t = emptyMemo (),
|
||||
a = lookupMemo (t, "abc"),
|
||||
b = lookupMemo (t, [1, 2, 3, 4, "abc"]),
|
||||
c = lookupMemo (t, f (5, 6));
|
||||
|
||||
printf ("Cached: %d\n", lookupMemo (t, "abc") == a);
|
||||
printf ("Cached: %d\n", lookupMemo (t, "abc") == a);
|
||||
printf ("Cached: %d\n", lookupMemo (t, "abc") == a);
|
||||
|
||||
printf ("Cached: %d\n", lookupMemo (t, [1, 2, 3, 4, "abc"]) == b);
|
||||
printf ("Cached: %d\n", lookupMemo (t, [1, 2, 3, 4, "abc"]) == b);
|
||||
printf ("Cached: %d\n", lookupMemo (t, [1, 2, 3, 4, "abc"]) == b);
|
||||
|
||||
printf ("Cached: %d\n", lookupMemo (t, f (5, 6)) == c);
|
||||
printf ("Cached: %d\n", lookupMemo (t, f (5, 6)) == c);
|
||||
printf ("Cached: %d\n", lookupMemo (t, f (5, 6)) == c)
|
||||
Loading…
Add table
Add a link
Reference in a new issue