Traverse from the beginning of a singly-linked list to the end.



See also

 Array
 Associative array: Creation, Iteration
 Collections
 Compound data type
 Doubly-linked list: Definition, Element definition, Element insertion, List Traversal, Element Removal
 Linked list
 Queue: Definition, Usage
 Set
 Singly-linked list: Element definition, Element insertion, List Traversal, Element Removal
 Stack


start:  LDA  load
        ADD  car   ; head of list
        STA  ldcar
 
        ADD  one
        STA  ldcdr
 
ldcar:  NOP
        STA  value
 
ldcdr:  NOP
        BRZ  done  ; 0 == NIL
        STA  car
 
        JMP  start
 
done:   LDA  value
        STP
 
load:   LDA  0
value:       0
car:         28    ; head of list
one:         1
 
20,21:       6, 0
22,23:       2, 26
24,25:       5, 20
26,27:       3, 30
28,29:       1, 22
30,31:       4, 24