Anonymous user
Singly-linked list/Element definition: Difference between revisions
Singly-linked list/Element definition (view source)
Revision as of 20:20, 22 September 2008
, 15 years agoLogo
m (Moved to Data struct cat) |
(Logo) |
||
Line 162:
Link(T a_data, Link<T> a_next) { next = a_next; data = a_data; }
}
=={{header|Logo}}==
As with other list-based languages, simple lists are represented easily in Logo.
fput item list ; add item to the head of a list
first list ; get the data
butfirst list ; get the remainder
bf list ; contraction for "butfirst"
These return modified lists, but you cal also destructively modify lists. These are normally not used because you might accidentally create cycles in the list.
.setfirst list value
.setbf list remainder
=={{header|OCaml}}==
|