Category talk:Wren-llist: Difference between revisions

→‎Source code: 'add' methods now return the item(s) added.
m (→‎Source code: Minor change to exchange() methods.)
(→‎Source code: 'add' methods now return the item(s) added.)
Line 87:
isEmpty { _count == 0 }
 
// Adds an element at the tail of the current instance and returns it.
add(d) {
var node = Node.new(d)
Line 101:
}
_tail = node
return d
}
 
// Adds a sequence of elements at the tail of the current instance and returns them.
addAll(a) {
if (!(a is Sequence)) Fiber.abort("Argument must be a Sequence.")
for (e in a) add(e)
return a
}
 
// Inserts an element at the head of the current instance and returns it.
prepend(d) { insert_(0, d) }
 
// Inserts a sequence of elements at the head of the current instance and returns them.
prependAll(a) {
if (!(a is Sequence)) Fiber.abort("Argument must be a Sequence.")
Line 120 ⟶ 122:
i = i + 1
}
return a
}
 
Line 527 ⟶ 530:
isEmpty { _count == 0 }
 
// Adds an element at the tail of the current instance and returns it.
add(d) {
var node = DNode.new(d)
Line 543 ⟶ 546:
}
_tail = node
return d
}
 
// Adds a sequence of elements at the tail of the current instance and returns them.
addAll(a) {
if (!(a is Sequence)) Fiber.abort("Argument must be a Sequence.")
for (e in a) add(e)
return a
}
 
// Inserts an element at the head of the current instance and returns it.
prepend(d) { insert_(0, d) }
 
// Inserts a sequence of elements at the head of the current instance and returns them.
prependAll(a) {
if (!(a is Sequence)) Fiber.abort("Argument must be a Sequence.")
Line 562 ⟶ 567:
i = i + 1
}
return a
}
 
9,476

edits