Category talk:Wren-seq: Difference between revisions
Content added Content deleted
(→Source code: Added 'indexOfSlice' and 'isSliceOf' methods to Lst class.) |
(→Source code: Removed type aliases and Lst.exchange method which are no longer needed.) |
||
Line 148: | Line 148: | ||
// Returns true if 's' is a slice of 'a' or false otherwise. |
// Returns true if 's' is a slice of 'a' or false otherwise. |
||
static isSliceOf(a, s) { indexOfSlice(a, s) >= 0 } |
static isSliceOf(a, s) { indexOfSlice(a, s) >= 0 } |
||
// Exchanges the elements at indices 'i' and 'j' of 'a'. |
|||
static exchange(a, i, j) { |
|||
isList_(a) |
|||
if (i == j) return |
|||
var t = a[i] |
|||
a[i] = a[j] |
|||
a[j] = t |
|||
} |
|||
// Returns true if 'a' contains ALL the values of a sequence, false otherwise. |
// Returns true if 'a' contains ALL the values of a sequence, false otherwise. |
||
Line 473: | Line 464: | ||
// Returns the string representation of the underlying list. |
// Returns the string representation of the underlying list. |
||
toString { _stack.toString } |
toString { _stack.toString } |
||
}</lang> |
|||
} |
|||
// Type aliases for classes in case of any name clashes with other modules. |
|||
var Seq_Seq = Seq |
|||
var Seq_Lst = Lst |
|||
var Seq_FrozenList = FrozenList |
|||
var Seq_Stack = Stack |
|||
var Seq_Cloneable = Cloneable // in case imported indirectly |
|||
var Seq_CloneableSeq = CloneableSeq // ditto</lang> |