Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
LIGO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
3
Snippets
Groups
Projects
Show more breadcrumbs
ligolang
LIGO
Commits
be6dff13
Commit
be6dff13
authored
4 years ago
by
Suzanne Dupéron
Browse files
Options
Downloads
Patches
Plain Diff
find_default function for Red-Black trees
parent
201eb8c9
Branches
Branches containing commit
Tags
Tags containing commit
Loading
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
vendors/Red-Black_Trees/PolyMap.ml
+4
-0
4 additions, 0 deletions
vendors/Red-Black_Trees/PolyMap.ml
vendors/Red-Black_Trees/PolyMap.mli
+7
-0
7 additions, 0 deletions
vendors/Red-Black_Trees/PolyMap.mli
with
11 additions
and
0 deletions
vendors/Red-Black_Trees/PolyMap.ml
+
4
−
0
View file @
be6dff13
...
...
@@ -31,6 +31,10 @@ let find key map =
let
find_opt
key
map
=
try
Some
(
find
key
map
)
with
Not_found
->
None
let
find_default
key
make_default_v
map
=
try
find
key
map
,
map
with
Not_found
->
let
v
=
make_default_v
()
in
v
,
add
key
v
map
let
has_key
key
map
=
match
find_opt
key
map
with
Some
_
->
true
...
...
This diff is collapsed.
Click to expand it.
vendors/Red-Black_Trees/PolyMap.mli
+
7
−
0
View file @
be6dff13
...
...
@@ -57,6 +57,13 @@ val find : 'key -> ('key, 'value) t -> 'value
val
find_opt
:
'
key
->
(
'
key
,
'
value
)
t
->
'
value
option
(* The value of the call [find_default key make_default_v map] is
[value] if the key [key] is bound to [value] in the map [map], and
[make_default_v ()] otherwise. In the first case, the
[make_default_v] function is not executed *)
val
find_default
:
'
key
->
(
unit
->
'
value
)
->
(
'
key
,
'
value
)
map
->
'
value
*
(
'
key
,
'
value
)
map
(* The value of the call [find_opt key map] is [true] if the key
[key] is bound to some value in the map [map], and [None]
otherwise. *)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment