Function CONS


Slots on this function:

Documentation:
The function {tt cons} adds the object specified as its first argument to the front of the list specified as its second argument.
Instance-Of: Function
Arity: 3

Axioms:

(Nth-Domain Cons 3 List)

(Nth-Domain Cons 2 List)


Other Related Axioms:

(<- (Butlast ?List)
    (Cond ((Null ?List) Bottom)
          ((Null (Rest ?List)) Nil)
          (True (Cons (First ?List) (Butlast (Rest ?List))))))

(<- (Cons ?X ?List) (If (= ?List (Listof @L)) (Listof ?X @L)))

(<- (Append ?L1 ?L2)
    (If (Null ?L1)
        (If (List ?L2) ?L2)
        (Cons (First ?L1) (Append (Rest ?L1) ?L2))))

(<- (Revappend ?L1 ?L2)
    (If (Null ?L1)
        (If (List ?L2) ?L2)
        (Revappend (Rest ?L1) (Cons (First ?L1) ?L2))))

(<- (Adjoin ?X ?List) (If (Item ?X ?List) ?List (Cons ?X ?List)))

(<- (Remove ?X ?List)
    (Cond ((Null ?List) Nil)
          ((And (= ?X (First ?List)) (List ?List))
           (Remove ?X (Rest ?List)))
          ((List ?List) (Cons ?X (Remove ?X (Rest ?List))))))

(<- (Subst ?X ?Y ?Z)
    (Cond ((= ?Y ?Z) ?X)
          ((Null ?Z) Nil)
          ((List ?Z)
           (Cons (Subst ?X ?Y (First ?Z)) (Subst ?X ?Y (Rest ?Z))))
          (True ?Z)))