Prop.mesa
Copyright Ó 1984, 1985, 1987, 1991 by Xerox Corporation. All rights reserved.
Michael Plass, January 7, 1987 11:11:40 am PST
Doug Wyatt, January 19, 1987 5:42:34 pm PST
~
BEGIN
PropList: TYPE ~ LIST OF Pair;
Pair: TYPE ~ RECORD [key: REF, val: REF];
Put:
PROC [propList: PropList, key:
REF, val:
REF]
RETURNS [PropList];
Returns a new list which contains (key, val). Get[Put[anyPropList, key, val], key]=val.
Get:
PROC [propList: PropList, key:
REF]
RETURNS [val:
REF];
Returns val associated with key, NIL if none. Uses REF equality to compare keys.
Rem:
PROC [propList: PropList, key:
REF]
RETURNS [PropList];
Returns a new list which does not contain key. Equivalent to Put[propList, key, NIL].
MapAction:
TYPE ~
PROC [key:
REF, val:
REF]
RETURNS [quit:
BOOL ¬
FALSE];
Map:
PROC [propList: PropList, action: MapAction]
RETURNS [
BOOL];
Enumerates the (key, val) pairs in the list; applies action to each pair until action returns TRUE or no more pairs; returns TRUE if some action returns TRUE.