Skip to content

Commit

Permalink
Add bindings for seq.++ and seq.unit (#323)
Browse files Browse the repository at this point in the history
* Add binding for seq.++ and seq.unit

Signed-off-by: Yage Hu <[email protected]>
  • Loading branch information
yagehu authored Dec 2, 2024
1 parent eb5796f commit 748b724
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions z3/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1829,6 +1829,11 @@ impl<'ctx> Seq<'ctx> {
}
}

/// Create a unit sequence of `a`.
pub fn unit<A: Ast<'ctx>>(ctx: &'ctx Context, a: &A) -> Self {
unsafe { Self::wrap(ctx, Z3_mk_seq_unit(ctx.z3_ctx, a.get_z3_ast())) }
}

/// Retrieve the unit sequence positioned at position `index`.
/// Use [`Seq::nth`] to get just the element.
pub fn at(&self, index: &Int<'ctx>) -> Self {
Expand Down Expand Up @@ -1871,6 +1876,11 @@ impl<'ctx> Seq<'ctx> {
pub fn length(&self) -> Int<'ctx> {
unsafe { Int::wrap(self.ctx, Z3_mk_seq_length(self.ctx.z3_ctx, self.z3_ast)) }
}

varop! {
/// Concatenate sequences.
concat(Z3_mk_seq_concat, Self);
}
}

impl<'ctx> Dynamic<'ctx> {
Expand Down

0 comments on commit 748b724

Please sign in to comment.