Jump to content

Wikifunctions:Catalogue/List operations

From Wikifunctions

Properties

Indexing/slicing

Removal/filtering

Substitution/transformation

Insertion

Generation

Ordering and grouping

Matrix math

Since we don't have specific types for vectors or matrices, vectors are represented as a list and matrices as a list of lists (to be interpreted as a list of rows).

Functions expecting a list argument

Functions with list outputs

  1. If a function specifies an output list with a type other than Z1 (that is, it specifies a "properly typed" list), mismatched elements cause an error if the implementation is in code.
  2. If all objects in an output list have the same type, the list takes that type instead of being Z1-typed. This only happens if the implementation is in code. For compositions, you can use return Typed list (Z18475) to get the same result.
  3. If a code implementation needs custom-converted objects (provided by a Type converter to code (Z46)), any list input must be properly typed (objects in a Z1-typed list are not converted). Similarly, any list output must be properly typed (not Z1 in the function specification) or else conversion into a Wikifunctions object will fail.
  4. If a code implementation does not need converted objects, you can use untype list if custom converters (Z28691) to convert a properly typed list to Z1-typed (but this is not officially supported). (The list will remain properly typed if there are no custom converters to code. Use untype a list (Z17895) to make the list Z1-typed unconditionally.)