From c7529d0b25c7195d6786b1c36aef3d0611bd65fe Mon Sep 17 00:00:00 2001 From: Nikolaj Bjorner Date: Thu, 9 May 2024 14:56:18 -0700 Subject: [PATCH] expose fold as well Signed-off-by: Nikolaj Bjorner --- src/api/python/z3/z3.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/api/python/z3/z3.py b/src/api/python/z3/z3.py index 44a4aba845f..c3f40a52bc7 100644 --- a/src/api/python/z3/z3.py +++ b/src/api/python/z3/z3.py @@ -11224,6 +11224,19 @@ def SeqMapI(f, i, s): i = _py2expr(i) return _to_expr_ref(Z3_mk_seq_mapi(s.ctx_ref(), f.as_ast(), i.as_ast(), s.as_ast()), ctx) +def SeqFoldLeft(f, a, s): + ctx = _get_ctx2(f, s) + s = _coerce_seq(s, ctx) + a = _py2expr(a) + return _to_expr_ref(Z3_mk_seq_foldl(s.ctx_ref(), f.as_ast(), a.as_ast(), s.as_ast()), ctx) + +def SeqFoldLeftI(f, i, a, s): + ctx = _get_ctx2(f, s) + s = _coerce_seq(s, ctx) + a = _py2expr(a) + i = _py2epxr(i) + return _to_expr_ref(Z3_mk_seq_foldli(s.ctx_ref(), f.as_ast(), i.as_ast(), a.as_ast(), s.as_ast()), ctx) + def StrToInt(s): """Convert string expression to integer >>> a = StrToInt("1")