Algosim documentation: ToList

ToList

Converts an object to a list.

Syntax

Description

If X is any object, then ToList(X) returns a list with the same content as X, to the extent it is possible.

If X isn’t a container, ToList(X) returns the single-element list '(X). This applies to numbers, booleans, colours, and sounds.

If X is a container, ToList(X) returns a list of all the elements in X. If X is an ordered container (e.g., a vector, a matrix, or a list), the elements in ToList(X) have the same order as in X. Otherwise (e.g., if X is a set), the order of the elements in ToList(X) is undefined. If X is a planar container (e.g., a matrix or a pixmap), row-major order is used.

These object types include vectors, matrices, lists, sets, strings, structures, and pixmaps. In the case of strings and pixmaps, the elements are characters and colours, respectively.

Notes

To obtain the characters of a string s, both ToList(s) and characters(s) can be used, and the results are identical. characters is the preferred function in this case.

See also