Difference between revisions of "Chained Dictionary Assignment"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
+ | <nowiki>signature DICTIONARY = sig | ||
+ | type (''k,'v) dictionary | ||
+ | val get : ((''k,'v) dictionary *''k) -> 'v option | ||
+ | val put : ((''k,'v) dictionary *''k *'v) -> 'v option | ||
+ | val remove : ((''k,'v) dictionary *''k) -> 'v option | ||
+ | val entries : (''k,'v) dictionary -> (''k*'v) list | ||
+ | val keys : (''k,'v) dictionary -> ''k list | ||
+ | val values : (''k,'v) dictionary -> 'v list | ||
+ | end</nowiki> | ||
+ | |||
=SingleList Implementation= | =SingleList Implementation= | ||
+ | <nowiki>signature SINGLE_LIST_DICTIONARY = sig include DICTIONARY | ||
+ | val create_simple : unit -> (''k,'v) dictionary | ||
+ | end</nowiki> | ||
=Hashtable Implementation= | =Hashtable Implementation= |
Revision as of 06:01, 25 June 2019
signature DICTIONARY = sig type (''k,'v) dictionary val get : ((''k,'v) dictionary *''k) -> 'v option val put : ((''k,'v) dictionary *''k *'v) -> 'v option val remove : ((''k,'v) dictionary *''k) -> 'v option val entries : (''k,'v) dictionary -> (''k*'v) list val keys : (''k,'v) dictionary -> ''k list val values : (''k,'v) dictionary -> 'v list end
SingleList Implementation
signature SINGLE_LIST_DICTIONARY = sig include DICTIONARY val create_simple : unit -> (''k,'v) dictionary end
Hashtable Implementation
signature HASHED_DICTIONARY = sig include DICTIONARY type ''k hash_function = ''k -> int val create_hashed : (int * ''k hash_function) -> (''k,'v) dictionary end