Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Why3
why3
Commits
0db025e5
Commit
0db025e5
authored
Aug 19, 2015
by
Andrei Paskevich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lists: add map_filter
parent
a61bd87a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
src/util/lists.ml
src/util/lists.ml
+5
-0
src/util/lists.mli
src/util/lists.mli
+2
-0
No files found.
src/util/lists.ml
View file @
0db025e5
...
...
@@ -28,6 +28,11 @@ let map_fold_right f l acc =
(
fun
e
(
l
,
acc
)
->
let
e
,
acc
=
f
e
acc
in
e
::
l
,
acc
)
l
([]
,
acc
)
let
map_filter
f
l
=
List
.
fold_right
(
fun
e
l
->
match
f
e
with
Some
e
->
e
::
l
|
None
->
l
)
l
[]
let
equal
pr
l1
l2
=
try
List
.
for_all2
pr
l1
l2
with
Invalid_argument
_
->
false
...
...
src/util/lists.mli
View file @
0db025e5
...
...
@@ -20,6 +20,8 @@ val map_fold_left :
val
map_fold_right
:
(
'
a
->
'
acc
->
'
b
*
'
acc
)
->
'
a
list
->
'
acc
->
'
b
list
*
'
acc
val
map_filter
:
(
'
a
->
'
b
option
)
->
'
a
list
->
'
b
list
val
equal
:
(
'
a
->
'
b
->
bool
)
->
'
a
list
->
'
b
list
->
bool
val
compare
:
(
'
a
->
'
a
->
int
)
->
'
a
list
->
'
a
list
->
int
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment