Charles.Forsyth20060303-partialeea662d19 years agoHistory
57 lines · 1.1 KB · Text
RawDownload
.TH DICT 2.SH NAMEdict - list of string pairs.SH SYNOPSIS.EXinclude "dict.m";dict := load Dictionary Dictionary->PATH; Dict: adt {	add: fn(d: self ref Dict, e: (string, string));	delete: fn(d: self ref Dict, k: string);	lookup: fn(d: self ref Dict, k: string): string;	keys: fn(d: self ref Dict): list of string;};.EE.SH DESCRIPTION.B Dictprovides a simple string to string association list:.TP.IB d .add( e )Adds a new tuple.IR eto the list,representing a new.RI ( "key ,\ value" )pair..TP.IB d .delete ( k )Deletes all pairs with key.I kfrom the list..TP.IB d .lookup( k )Tries to find a pair with key.I kand returns its associated value,or nil if the key was not found..TP.IB d .keys()Returns a list of allkeysin the list..SH SOURCE.B /appl/lib/dict.b.SH SEE ALSO.IR hash (2).SH BUGSNo attempt is made tokeep keys unique in the list; if morethan one pair exists with the same key, then.B lookupwill select one of them arbitrarily..PPComputational overhead of lookup and deletion ofkeys is proportionalto the number of pairs in the list. 

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t