On Sat, Mar 17, 2012 at 07:11:30PM +0100, Ralf Hemmecke wrote:
> https://github.com/hemmecke/fricas-svn/blob/master/src/algebra/table.spad.pamphlet
Yes, I am looking into HasTable(Key, Entry, hashfn),
and even managed to use an example with HasTable(INT, String, "ID").
-------------------------------------------------------
INT ==> Integer
Item ==> Record(key : INT, entry : String)
Tab ==> HashTable(INT, String, "ID")
)abbrev package FOO Foo
Foo() : with
tab : () -> Tab
==
add
tab() ==
item1 := [1, "1"] :: Item
item2 := [2, "2"] :: Item
itemList : List Item := [item1, item2]
construct(itemList) $Tab
-------------------------------------------------------
(11) -> tab1:= tab()
(11) table(2= "2",1= "1") Type: HashTable(Integer,String,ID)
(12) -> search(2, tab1)
(12) "2" Type: Union(String,...)
Does "ID" mean to compare the keys as they are?
Will this be a binary search?
Key is declared of SetCategory.
And the binary search requires a total ordering on Key, which, I think,
is beyond SetCategory (?)
May be, this is some internally used ordering, I do not know ...
How to set hashfn is a bit unclear: "ID", "EQ" ...
So far, I am trying "ID" and hope for the binary search.
In the GHC library for Haskell, we have Ord key => Map key elt,
where Ord enables to compare the keys by `compare' and ">",
and this `compare' can be programmed by the user.
Thanks,
------
Sergei
[email protected]
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.