3 Mutable List Functions
(require compatibility/mlist) | |
package: compatibility-lib |
This compatibility/mlist library provides support for mutable lists. Support is provided primarily to help porting Lisp/Scheme code to Racket.
Use of mutable lists for modern Racket code is strongly discouraged. Instead, consider using lists.
For functions described in this section, contracts are not directly enforced. In particular, when a mutable list is expected, supplying any other kind of value (or mutating a value that starts as a mutable list) tends to produce an exception from mcar or mcdr.
Returns #t if
v is a mutable list: either the empty list,
or a mutable pair whose second element is a
mutable list.
Returns a newly allocated
mutable list containing the vs as its
elements.
procedure
(list->mlist lst) → mlist?
lst : list?
Returns a newly allocated mutable list with the same
elements as lst.
procedure
(mlist->list mlst) → list?
mlst : mlist?
Returns a newly allocated list with the same elements as
mlst.
procedure
(mlength mlst) → exact-nonnegative-integer?
mlst : mlist?
Returns the number of elements in mlst.
procedure
mlst : mlist? pos : exact-nonnegative-integer?
Like list-ref, but for mutable lists.
procedure
(mlist-tail mlst pos) → any/c
mlst : mlist? pos : exact-nonnegative-integer?
Like list-tail, but for mutable lists.
Like append, but for mutable lists.
The mappend! procedure appends the given
mutable lists by mutating
the tail of each to refer to the next, using set-mcdr!. Empty
lists are dropped; in particular, the result of calling
mappend! with one or more empty lists is the same as the
result of the call with the empty lists removed from the set of
arguments.
Like reverse, but for mutable lists.
Like mreverse, but destructively reverses the
mutable list by using all of the mutable pairs in
mlst and changing them with set-mcdr!.
procedure
proc : procedure? mlst : mlist?
Like map, but for mutable lists.
procedure
proc : procedure? mlst : mlist?
Like for-each, but for mutable lists.
Like member, but for mutable lists.
Like memv, but for mutable lists.
Like memq, but for mutable lists.
Returns a procedure that returns #t when given a
mutable list for which pred returns a true
value for all elements.
(require racket/mpair) | package: compatibility-lib |
The racket/mpair library
re-exports compatibility/mlist for backward
compatibility.