Singly-linked list/Reversal: Difference between revisions

Content added Content deleted
Line 14: Line 14:
MODE STRINGLIST = STRUCT(STRING value, REF STRINGLIST next);
MODE STRINGLIST = STRUCT(STRING value, REF STRINGLIST next);


# construct a STRINGLIST wuth a few elments #
# construct a STRINGLIST with a few elmeents #
STRINGLIST list := ("Big",
STRINGLIST list := ("Big",
LOC STRINGLIST := ("fjords",
LOC STRINGLIST := ("fjords",
Line 22: Line 22:
LOC STRINGLIST := ("nymph",NIL))))));
LOC STRINGLIST := ("nymph",NIL))))));


# print the list and buuild the reverse list #
# print the list and build the reverse list #
REF STRINGLIST node := list;
REF STRINGLIST node := list;
REF STRINGLIST reverse := REF STRINGLIST(NIL);
REF STRINGLIST reverse := REF STRINGLIST(NIL);