Singly-linked list/Traversal: Difference between revisions

Content added Content deleted
Line 512: Line 512:


=={{header|ATS}}==
=={{header|ATS}}==

I repeated the [[Singly-linked_list/Element_definition#ATS|‘Rosetta Code linear list type’]] here, so you can simply copy
the code below, compile it, and run it.

Also I put the executable parts in initialization rather than the main program,
to avoid being forced to ‘consume’ the list (free its memory). I felt that would be a distraction.

The traversal function is proven to terminate.

<lang ATS>(*------------------------------------------------------------------*)
<lang ATS>(*------------------------------------------------------------------*)


Line 597: Line 606:
implement
implement
main0 () = ()</lang>
main0 () = ()</lang>

{{out}}
<pre>$ patscc -DATS_MEMALLOC_LIBC singly_linked_list_traversal.dats && ./a.out
123
456
789</pre>


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==