kdrag.datatype.datatype_replace

kdrag.datatype.datatype_replace(self: DatatypeRef, **kwargs: ExprRef) DatatypeRef

Like NamedTuple, you can replace fields of a record datatype.

>>> Point = kd.Struct("Point", ("x", smt.RealSort()), ("y", smt.RealSort()))
>>> Point(0,1)._replace(x=3, y=10)
Point(3, 10)
>>> p = smt.Const("p", Point)
>>> q = p._replace(y=10)
>>> q
Point(x(p), 10)
>>> q._replace(x=1)
Point(1, 10)
Parameters:
  • self (DatatypeRef)

  • kwargs (ExprRef)

Return type:

DatatypeRef