Utils
-
Utility functions that deals with lists.
-
Value summary
|
val listConcatWith : 'a list -> 'a list list -> 'a list
flattens a list of list, inserting a separator between each inner lists.
|
val listEquals : ''a list -> ''a list -> bool
check if the two lists contains the same elements (not considering their
position in the list).
|
val listFusion : ''a list -> ''a list -> ''a list
merges the two list without duplicating identical elements.
|
val listFusionPair : ''a list * ''a list -> ''a list
merges the two list without duplicating identical elements.
|
val listMember : ''a -> ''a list -> bool
check if the given element belongs to the list.
|
val listMemberRemove : ''a -> ''a list -> bool * ''a list
check if the given element belongs to the list, and removes it.
|
listMember
fun listMember e l : ''a -> ''a list -> bool
-
check if the given element belongs to the list.
-
- Parameters:
-
-
e
-
the element.
-
l
-
the list.
- Returns:
-
true if e belongs to l, else false.
listFusion
fun listFusion l1 l2 : ''a list -> ''a list -> ''a list
-
merges the two list without duplicating identical elements.
-
- Parameters:
-
-
l1
-
the first list.
-
l2
-
the second list.
- Returns:
-
l1 followed by (l2 - l1).
listFusionPair
fun listFusionPair l1 l2 : ''a list * ''a list -> ''a list
-
merges the two list without duplicating identical elements.
-
- Parameters:
-
-
l1
-
the first list.
-
l2
-
the second list.
- Returns:
-
l1 followed by (l2 - l1).
listMemberRemove
fun listMemberRemove e l : ''a -> ''a list -> bool * ''a list
-
check if the given element belongs to the list, and removes it.
-
- Parameters:
-
-
e
-
the element.
-
l
-
the list.
- Returns:
-
( (true if e belongs to l, else false) , (l without e) ).
listEquals
fun listEquals l1 l2 : ''a list -> ''a list -> bool
-
check if the two lists contains the same elements (not considering their
position in the list).
-
- Parameters:
-
-
l1
-
the first list.
-
l2
-
the second list.
- Returns:
-
true if and only if l1 and l2 contains the same elements.
listConcatWith
fun listConcatWith sep l : 'a list -> 'a list list -> 'a list
-
flattens a list of list, inserting a separator between each inner lists.
-
- Parameters:
-
-
sep
-
the separator (itself a list).
-
l
-
the list list [l1, l2, ..., ln].
- Returns:
-
l1 @ sep @ l2 @ ... @ ln.