StackAction: +map
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Alain Emilia Anna Zscheile 2024-02-24 13:46:34 +01:00
parent d406edfa82
commit 16ea1b7d57
2 changed files with 13 additions and 0 deletions

View file

@ -14,3 +14,5 @@ let merge lhs rhs =
{ pop = lhs.pop + pop; push = List.append push rhs.push; }
let empty = { pop = 0; push = []; }
let map f sta = { pop = sta.pop; push = List.map f sta.push; }

11
lib/StackAction.mli Normal file
View file

@ -0,0 +1,11 @@
(** A stack action (pop is run first, then push sequentially) *)
type 'a t =
{ pop : int
; push : 'a list
}
val merge : 'a t -> 'a t -> 'a t
val empty : 'a t
val map : ('a -> 'b) -> 'a t -> 'b t