Class Cons


public class Cons extends PrimitiveFunction
Prepends an element to a list.
  • Field Details

    • NAME

      public static final Name NAME
  • Constructor Details

    • Cons

      public Cons()
  • Method Details

    • name

      public Name name()
      Description copied from class: PrimitiveFunction
      The unique name of the primitive function.
      Specified by:
      name in class PrimitiveFunction
      Returns:
      the name of this primitive function
    • type

      public TypeScheme type()
      Description copied from class: PrimitiveFunction
      The datatype of the primitive function.
      Specified by:
      type in class PrimitiveFunction
      Returns:
      the type scheme of this primitive function
    • implementation

      protected Function<List<Term>,Flow<Graph,Term>> implementation()
      Description copied from class: PrimitiveFunction
      A dynamic/interpreted implementation of the function.
      Specified by:
      implementation in class PrimitiveFunction
      Returns:
      the function implementation
    • apply

      public static <X> List<X> apply(X el, List<X> l)
      Apply the function to both arguments.
      Type Parameters:
      X - the element type
      Parameters:
      el - the element to prepend
      l - the list to prepend to
      Returns:
      the list with the element prepended