I think you could always use any type as table keys but it used to be really
slow and it got better when serial numbers were introduced for structure types.
They're still of dubious utility since equivalent structures don't map to the
same key.
Clint
-------- Original message --------
From: user <[email protected]>
Date: 06/07/2014 12:53 PM (GMT-08:00)
To: Unicon group <[email protected]>
Subject: [Unicon-group] Table keys
It's official now: you CAN use lists (and records?... and even tables?) as
table keys!
Although there seems to be a catch:
#global Table #### GLOBAL or LOCAL doesn't matter!
procedure main()
local l1,l3,l4,l5,l6,k,Table
l1:=["test","test-1"]
l3:=copy(l1);l4:=copy(l1);l5:=copy(l1);l6:=copy(l1)
Table:=&null; Table:=table(); k:=&null
#------------------------------------------
Table[["test","test-1"]]:=22; write(*Table)
Table[["test","test-1"]]:=33; write(*Table)
Table[["test","test-1"]]:=44; write(*Table)
Table[["test","test-1"]]:=55; write(*Table)
every (k:=key(Table),write(Table[k]))
#------------------------------------------
write()
Table:=&null; Table:=table(); k:=&null
Table[l3]:=66; write(*Table)
Table[l4]:=77; write(*Table)
Table[l5]:=88; write(*Table)
Table[l6]:=99; write(*Table)
every (k:=key(Table),write(Table[k]))
#=========================================OK (expected behavior)
write()
Table:=&null; Table:=table(); k:=&null
Table[l1]:=6; write(*Table)
Table[l1]:=7; write(*Table)
Table[l1]:=8; write(*Table)
Table[l1]:=9; write(*Table)
every (k:=key(Table),write(Table[k]))
write("OK-OK-OK!")
#=========================================OK (expected behavior)
end
## Bob ##
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group