Associative array/Merging: Difference between revisions

Content added Content deleted
(added Ol)
(→‎{{header|ALGOL 68}}: Minor update to the associative array MODEs etc.)
Line 48: Line 48:
Uses the associative array implementations in [[ALGOL_68/prelude]].
Uses the associative array implementations in [[ALGOL_68/prelude]].
<lang algol68># associative array merging #
<lang algol68># associative array merging #

# the modes allowed as associative array element values - change to suit #
# the modes allowed as associative array element values - change to suit #
MODE AAVALUE = UNION( STRING, INT, REAL );
MODE AAVALUE = UNION( STRING, INT, REAL );
# the modes allowed as associative array element keys - change to suit #
# the modes allowed as associative array element keys - change to suit #
MODE AAKEY = STRING;
MODE AAKEY = STRING;
# initial value for an array element #

AAVALUE init element value = "";
# include the associative array code #
# include the associative array code #
PR read "aArrayBase.a68" PR
PR read "aArrayBase.a68" PR

# adds or replaces all elements from b into a #
# adds or replaces all elements from b into a #
PRIO UPDATE = 9;
PRIO UPDATE = 9;
Line 68: Line 70:
a
a
END # UPDATE # ;
END # UPDATE # ;

# construct the associative arrays for the task #
# construct the associative arrays for the task #
REF AARRAY a := INIT LOC AARRAY;
REF AARRAY a := INIT LOC AARRAY;