From 2c89a49ba8edf8714fa9a47b4727887db314a43f Mon Sep 17 00:00:00 2001 From: zapashcanon Date: Mon, 19 Feb 2024 16:54:33 +0100 Subject: [PATCH] use fold_left instead of filteri because it is not available on old OCaml versions --- src/api/ml/z3.ml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/api/ml/z3.ml b/src/api/ml/z3.ml index d26528acb..0be6e57a0 100644 --- a/src/api/ml/z3.ml +++ b/src/api/ml/z3.ml @@ -2086,7 +2086,14 @@ struct let mk_roots (ctx:context) (a:rcf_num list) = let n, r = Z3native.rcf_mk_roots ctx (List.length a) a in - List.filteri (fun i _v -> i < n) r + let _i, l = + (* keep only the first `n` elements of the list `r` *) + List.fold_left (fun (i, acc) x -> + if i = 0 then i, acc + else (i - 1, x :: acc) + ) (n, []) r + in + List.rev l let add (ctx:context) (a:rcf_num) (b:rcf_num) = Z3native.rcf_add ctx a b let sub (ctx:context) (a:rcf_num) (b:rcf_num) = Z3native.rcf_sub ctx a b