pub const HASHMAP: &str = "\n\"hashing.spl\" import\n\"linkedlist.spl\" import\n\nconstruct HashMap {\n\tsize\n\tbuckets\n\tfunction\n\tmaxload\n\toptload\n\t;\n\tconstruct { this | with this ;\n\t\t0 this:=size;\n\t\t16 anew:map<| pop LinkedList:new> this:=buckets;\n\t\t&hash this:=function;\n\t\t3 this:=maxload;\n\t\t2 this:=optload;\n\t\tthis\n\t}\n\tbalance { | with this ;\n\t\tthis:size this:buckets:len / this:maxload gt if {\n\t\t\tdef new-buckets this:size this:optload / anew =new-buckets\n\t\t\tnew-buckets:len:foreach<| with i ; LinkedList:new i new-buckets:set; >\n\t\t\t{ | with bucket ;\n\t\t\t\tbucket null eq if {\n\t\t\t\t\t2 stop\n\t\t\t\t}\n\t\t\t\t{ | dup :to-stack with entry key value ;\n\t\t\t\t\tentry (key this:function:call new-buckets:len %) new-buckets:get:push;\n\t\t\t\t} bucket:foreach;\n\t\t\t} this:buckets:foreach;\n\t\t\tnew-buckets this:=buckets\n\t\t}\n\t}\n\tget { value | with key this ;\n\t\tnull\n\t\n\t\t(key this:function:call) this:buckets:len % this:buckets:get\n\t\t:foreach<| :to-stack with k v ;\n\t\t\tk key eq if { pop v }\n\t\t>\n\t}\n\tset { oldvalue | with value key this ;\n\t\tdef found 0 =found\n\t\tnull\n\t\tdef bk key this:function:call this:buckets:len % this:buckets:get dup =bk\n\t\t:foreach<| with entry ;\n\t\t\tentry:0 key eq if {\n\t\t\t\tpop entry:1\n\t\t\t\tvalue entry:=1;\n\t\t\t\t1 =found\n\t\t\t}\n\t\t>;\n\n\t\tfound not if {\n\t\t\t[ key value ] bk:push;\n\t\t\tthis:size ++ this:=size\n\t\t}\n\t}\n\tget-or-create-entry { entry | with key this ;\n\t\tnull\n\t\tdef bk key this:function:call this:buckets:len % this:buckets:get dup =bk\n\t\t:foreach<| with entry ;\n\t\t\tentry:0 key eq if {\n\t\t\t\tpop entry\n\t\t\t}\n\t\t>;\n\n\t\tdup null eq if {\n\t\t\t[ key null ] dup bk:push;\n\t\t\tthis:size ++ this:=size\n\t\t}\n\t}\n}\n\n";