Doubly-linked list/Traversal: Difference between revisions
Rename Perl 6 -> Raku, alphabetize, minor clean-up
m (added whitespace before the table of contents (TOC).) |
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
||
Line 200:
YEARS : +40
</pre>
=={{header|ARM Assembly}}==
{{works with|as|Raspberry Pi}}
Line 486 ⟶ 487:
</lang>
=={{header|AutoHotkey}}==
see [[Doubly-linked list/AutoHotkey]]
Line 690 ⟶ 692:
return 0;
}</lang>
=={{header|C++}}==▼
{{works with|C++11}}▼
<lang cpp>#include <iostream>▼
#include <list>▼
int main ()▼
{▼
std::list<int> numbers {1, 5, 7, 0, 3, 2};▼
for(const auto& i: numbers)▼
std::cout << i << ' ';▼
std::cout << '\n';▼
}</lang>▼
{{out}}▼
<pre>▼
1 5 7 0 3 2 ▼
</pre>▼
=={{header|C sharp}}==
Line 749 ⟶ 734:
e
h</pre>
▲=={{header|C++}}==
▲{{works with|C++11}}
▲<lang cpp>#include <iostream>
▲#include <list>
▲int main ()
▲{
▲ std::list<int> numbers {1, 5, 7, 0, 3, 2};
▲ for(const auto& i: numbers)
▲ std::cout << i << ' ';
▲ std::cout << '\n';
▲}</lang>
▲{{out}}
▲<pre>
▲1 5 7 0 3 2
▲</pre>
=={{header|Clojure}}==
Line 886 ⟶ 888:
=={{header|Erlang}}==
The task in [[Doubly-linked_list/Element_insertion]] uses traversal as proof that the insertion worked.
=={{header|Fortran}}==▼
see [[Doubly-linked list/Definition#Fortran]]▼
=={{header|F#}}==
Line 923 ⟶ 922:
'z''y''x''w''v''u''t''s''r''q''p''o''n''m''l''k''j''i''h''g''f''e''d''c''b''a'
</pre>
▲=={{header|Fortran}}==
▲see [[Doubly-linked list/Definition#Fortran]]
=={{header|Go}}==
Line 1,527 ⟶ 1,529:
for i in l.traverseBackward():
echo "< ", i</lang>
=={{header|Oberon-2}}==
<lang oberon2>
Line 1,560 ⟶ 1,563:
END Collections.
</lang>
=={{header|Objeck}}==
<lang objeck>
Line 1,698 ⟶ 1,702:
=={{header|Pascal}}==
See [[Doubly-linked_list/Traversal#Delphi | Delphi]]
=={{header|Perl 6}}==▼
Since the list routines are supplied by the generic roles defined in [[Doubly-linked_list/Definition#Perl_6]], it suffices to say:▼
<lang perl6>say $dll.list;▼
say $dll.reverse;</lang>▼
These automatically return just the payloads, hiding the elements containing the forward and backward pointers.▼
=={{header|Phix}}==
Line 1,936 ⟶ 1,935:
(loop (cons (dlink-content dlink) elements) (dlink-next dlink))
elements)))</lang>
(formerly Perl 6)
▲Since the list routines are supplied by the generic roles defined in [[Doubly-linked_list/Definition#Perl_6]], it suffices to say:
▲<lang perl6>say $dll.list;
▲say $dll.reverse;</lang>
▲These automatically return just the payloads, hiding the elements containing the forward and backward pointers.
=={{header|REXX}}==
Line 2,222 ⟶ 2,228:
traverse(ll.descendingIterator)
}</lang>
=={{header|Tcl}}==
Assuming that the <code>List</code> class from [[Doubly-Linked List (element)#Tcl|this other task]] is already present...
|