Singly-linked list/Traversal: Difference between revisions
Content added Content deleted
(Better first D entry) |
No edit summary |
||
Line 1: | Line 1: | ||
{{task|Data Structures}}[[Category:Iteration]] |
{{task|Data Structures}}[[Category:Iteration]] |
||
Traverse from the beginning of a singly-linked list to the end. |
Traverse from the beginning of a singly-linked list to the end. |
||
=={{header|ACL2}}== |
|||
The standard list data type is a singly linked list. |
|||
<lang Lisp>(defun traverse (xs) |
|||
(if (endp xs) |
|||
(cw "End.~%") |
|||
(prog2$ (cw "~x0~%" (first xs)) |
|||
(traverse (rest xs)))))</lang> |
|||
=={{header|ActionScript}}== |
=={{header|ActionScript}}== |