RosettaCodeData/Task/Singly-linked-list-Element-definition/Pop11/singly-linked-list-element-definition-2.pop11
2023-07-01 13:44:08 -04:00

16 lines
332 B
Text

uses objectclass;
define :class ListNode;
slot value = [];
slot next = [];
enddefine;
;;; Allocate new node and assign to l1
newListNode() -> l1;
;;; Print it
l1 =>
;;; modify value
1 -> value(l1);
l1 =>
;;; Allocate new node with initialized values and assign to link field
;;; of l1
consListNode(2, []) -> next(l1);
l1 =>