Module type Ptree.S
Structures whose tensor leaves can be traversed.
Implementations must satisfy:
map f tappliesfto every tensor leaf oftexactly once and preserves the structure oft.map2 f a bappliesfto corresponding leaves ofaandb, which must be structurally equal.iter f tappliesfto every tensor leaf oftexactly once, in a stable order.
val map : ('a 'b. ('a, 'b) Nx_effect.t -> ('a, 'b) Nx_effect.t) -> t -> tmap f t is t with f applied to every tensor leaf.
val map2 :
('a 'b. ('a, 'b) Nx_effect.t -> ('a, 'b) Nx_effect.t -> ('a, 'b) Nx_effect.t) ->
t ->
t ->
tmap2 f a b is a and b combined leafwise with f.
Raises Invalid_argument if a and b are not structurally equal.
val iter : ('a 'b. ('a, 'b) Nx_effect.t -> unit) -> t -> unititer f t applies f to every tensor leaf of t.