Jump to content

Singly-linked list/Element definition: Difference between revisions

Logo
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}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.