Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bindings for seq.++ and seq.unit #323

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading