Category talk:Wren-llist: Difference between revisions

m
→‎Source code: Now uses Wren S/H lexer.
(→‎Source code: 'add' methods now return the item(s) added.)
m (→‎Source code: Now uses Wren S/H lexer.)
 
(3 intermediate revisions by the same user not shown)
Line 13:
For various reasons (efficient indexing, smaller memory footprint, more cache friendly) dynamic arrays tend to be preferred to linked lists nowadays and it is not expected that this module will see much use outside of RC particularly as it is written entirely in Wren whereas the built-in List class is written mostly in C. Consequently, only limited effort has been made to optimize the implementation.
===Source code===
<langsyntaxhighlight ecmascriptlang="wren">/* Module "llist.wren" */
 
/* Node is a building block for a singly linked list. As such it consists of two fields:
Line 981:
// Returns the string representation of the current instance.
toString { "[" + toList.join(" <-> ") +"]" }
}</syntaxhighlight>
}
 
// Type aliases for classes in case of any name clashes with other modules.
var LList_Node = Node
var LList_LinkedList = LinkedList
var LList_DNode = DNode
var LList_DLinkedList = DLinkedList</lang>
9,476

edits