package rfsm
Module Ext.ListSource
cart_prod l1 l2 returns the cartesian product of lists l1 and l2. For instance, if l1=[1;2] and l2=["a";"b"], then cart_prod l1 l2 is [(1,"a");(1,"b");(2,"a");(2,"b")]
replace_assoc k v l replaces the value bound to key k in association list l by v. If k was bound in l, the binding (k,v) is added to l.
add_list_assoc k v add value v to the _list of values_ bound to k in l. If key k is not bound in l, add it, with associated value [v].
scatter f l applies f to each element of l and returns the list of distinct results, with each result paired with the list of corresponding elements. For example: scatter String.length ["a";"abc";"bac";"abcdef"] is [(6, ["abcdef"]); (3, ["bac"; "abc"]); (1, ["a"])]
iter_fst f l behaves like Stdlib.List.iter f l but the f function takes an extra argument indicating whether the argument is the first of the source list or not
fold_leftr f l z is Stdlib.fold_left f z l
pp_v pp fmt l prints list l on formatter fmt using printer pp for each element, one line per element
val pp_h :
?sep:string ->
(Format.formatter -> 'a -> unit) ->
Format.formatter ->
'a list ->
unitpp_h pp fmt l prints list l on formatter fmt using printer pp for each element, on a single line, and printing the optional string sep between elements.
val pp_opt :
lr:(string * string) ->
sep:string ->
(Format.formatter -> 'a -> unit) ->
Format.formatter ->
'a list ->
unitpp_opt lr:(l,r) sep pp l is prints l using pp_h sep pp between l and r delimiters but prints nothing if l is empty.
val pp_assoc :
((Format.formatter -> 'a -> unit) * (Format.formatter -> 'b -> unit)) ->
Format.formatter ->
('a * 'b) list ->
unitpp_assoc (pp_k,pp_v) fmt l prints association list l on formatter fmt using printer pp_k (resp. pp_v for printing keys (resp. values).