Unifiable

public enum Unifiable<Element: Equatable>

Recursively unifiable type that allows for representation of both variables and constant values. May be used as a building block to build tree-like unification types.

  • A value that cannot be changed.

    Declaration

    Swift

    case Constant(Element)
  • A value that is determined by unification.

    Declaration

    Swift

    case Variable(Binding<Element>)
  • The current value otherwise nil if it is undetermined.

    Declaration

    Swift

    public var value: Element?
  • A textual representation of the value or the binding if no value exists.

    Declaration

    Swift

    public var description: String
  • Unifies lhs with rhs, otherwise throws a UnificationError.

    Declaration

    Swift

    public static func unify(lhs: Unifiable, _ rhs: Unifiable) throws
  • Performs action as an operation on self such that the self preserves its initial glue value if the operation fails.

    Declaration

    Swift

    public static func attempt(value: Unifiable, _ action: () throws -> ()) throws
  • Recursively unifies lhs with rhs, otherwise throws a UnificationError.

    Declaration

    Swift

    public static func unify(lhs: Unifiable, _ rhs: Unifiable) throws
  • Performs action as an operation on self such that the self preserves its initial glue value if the operation fails.

    Declaration

    Swift

    public static func attempt(value: Unifiable, _ action: () throws -> ()) throws
  • Copies this reusing any substructure that has already been copied within this context, and storing any newly generated substructure into the context.

    Declaration

    Swift

    public static func copy(this: Unifiable, withContext context: CopyContext) -> Unifiable
  • Copies this reusing any substructure that has already been copied within this context, and storing any newly generated substructure into the context.

    Declaration

    Swift

    public static func copy(this: Unifiable, withContext context: CopyContext) -> Unifiable