mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
small changes
This commit is contained in:
parent
a45fccca98
commit
de7246b75c
2 changed files with 6 additions and 3 deletions
|
|
@ -168,6 +168,7 @@ module Fut = struct
|
|||
let map f fut =
|
||||
let res, send = create () in
|
||||
subscribe fut (fun x -> send (f x));
|
||||
subscribe res (fun _ -> ignore fut); (* keep ref *)
|
||||
res
|
||||
|
||||
let first l =
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
(** {2 Behavior tree} *)
|
||||
|
||||
(** A behavior tree *)
|
||||
type tree = private
|
||||
| Test of bool React.event (* test the next occurrence *)
|
||||
| TestFun of (unit -> bool) (* call and test value *)
|
||||
|
|
@ -59,12 +60,13 @@ type tree = private
|
|||
| Select of select_strategy * tree list (* select one subtree *)
|
||||
| Parallel of parallel_strategy * tree list (* run all subtrees in parallel *)
|
||||
| Closure of (unit -> tree) (* build a tree dynamically *)
|
||||
| Succeed
|
||||
| Fail
|
||||
(** A behavior tree *)
|
||||
| Succeed (* always succeed *)
|
||||
| Fail (* always fail *)
|
||||
|
||||
and select_strategy = tree list -> (unit -> tree option)
|
||||
(** How to select a subtree to run. It may yield a different result each
|
||||
time it is called. *)
|
||||
|
||||
and parallel_strategy =
|
||||
| PSForall (** succeeds when all subtrees succeed *)
|
||||
| PSExists (** succeeds when some subtree succeeds (kill the others) *)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue