forked from JasonGross/neural-net-coq-interp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapt to coq/coq#18197 (List and Array fold argument order change)
Should be backwards compatible (by vendoring the new definition until backward compat is dropped)
- Loading branch information
1 parent
83cccf5
commit 765977e
Showing
4 changed files
with
34 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
From Ltac2 Require Import Array Init. | ||
|
||
(** Definitions to be dropped when <8.19 compat is dropped *) | ||
|
||
Ltac2 rec fold_right_aux (f : 'a -> 'b -> 'b) (a : 'a array) (x : 'b) (pos : int) (len : int) := | ||
(* Note: one could compare pos<0. | ||
We keep an extra len parameter so that the function can be used for any sub array *) | ||
match Int.equal len 0 with | ||
| true => x | ||
| false => fold_right_aux f a (f (get a pos) x) (Int.sub pos 1) (Int.sub len 1) | ||
end. | ||
|
||
Ltac2 fold_right (f : 'a -> 'b -> 'b) (a : 'a array) (x : 'b) : 'b := | ||
fold_right_aux f a x (Int.sub (length a) 1) (length a). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters