Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
why3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
119
Issues
119
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Why3
why3
Commits
747bc5fe
Commit
747bc5fe
authored
Aug 18, 2010
by
Andrei Paskevich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename Util.memo to Util.memo_int
parent
eb053d42
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
19 deletions
+10
-19
src/core/term.ml
src/core/term.ml
+2
-4
src/core/theory.ml
src/core/theory.ml
+2
-4
src/core/ty.ml
src/core/ty.ml
+3
-6
src/util/util.ml
src/util/util.ml
+1
-1
src/util/util.mli
src/util/util.mli
+2
-4
No files found.
src/core/term.ml
View file @
747bc5fe
...
...
@@ -582,14 +582,12 @@ let ps_equ =
let
f_equ
t1
t2
=
f_app
ps_equ
[
t1
;
t2
]
let
f_neq
t1
t2
=
f_not
(
f_app
ps_equ
[
t1
;
t2
])
let
fs_tuple
n
=
let
fs_tuple
=
Util
.
memo_int
17
(
fun
n
->
let
tyl
=
ref
[]
in
for
i
=
1
to
n
do
tyl
:=
ty_var
(
create_tvsymbol
(
id_fresh
"a"
))
::
!
tyl
done
;
let
ty
=
ty_tuple
!
tyl
in
create_fsymbol
(
id_fresh
(
"Tuple"
^
string_of_int
n
))
!
tyl
ty
let
fs_tuple
=
Util
.
memo
fs_tuple
create_fsymbol
(
id_fresh
(
"Tuple"
^
string_of_int
n
))
!
tyl
ty
)
let
is_fs_tuple
fs
=
fs
==
fs_tuple
(
List
.
length
fs
.
ls_args
)
...
...
src/core/theory.ml
View file @
747bc5fe
...
...
@@ -702,12 +702,10 @@ let builtin_theory =
let
create_theory
n
=
use_export
(
empty_theory
n
)
builtin_theory
let
tuple_theory
n
=
let
tuple_theory
=
Util
.
memo_int
17
(
fun
n
->
let
uc
=
empty_theory
(
id_fresh
(
"Tuple"
^
string_of_int
n
))
in
let
uc
=
add_ty_decl
uc
[
ts_tuple
n
,
Talgebraic
[
fs_tuple
n
]]
in
close_theory
uc
let
tuple_theory
=
Util
.
memo
tuple_theory
close_theory
uc
)
(* Exception reporting *)
...
...
src/core/ty.ml
View file @
747bc5fe
...
...
@@ -218,15 +218,12 @@ let ts_real = create_tysymbol (id_fresh "real") [] None
let
ty_int
=
ty_app
ts_int
[]
let
ty_real
=
ty_app
ts_real
[]
let
ts_tuple
n
=
let
ts_tuple
=
Util
.
memo_int
17
(
fun
n
->
let
vl
=
ref
[]
in
for
i
=
1
to
n
do
vl
:=
create_tvsymbol
(
id_fresh
"a"
)
::
!
vl
done
;
create_tysymbol
(
id_fresh
(
"tuple"
^
string_of_int
n
))
!
vl
None
create_tysymbol
(
id_fresh
(
"tuple"
^
string_of_int
n
))
!
vl
None
)
let
ts_tuple
=
Util
.
memo
ts_tuple
let
ty_tuple
tyl
=
ty_app
(
ts_tuple
(
List
.
length
tyl
))
tyl
let
ty_tuple
tyl
=
ty_app
(
ts_tuple
(
List
.
length
tyl
))
tyl
let
is_ts_tuple
ts
=
ts
==
ts_tuple
(
List
.
length
ts
.
ts_args
)
src/util/util.ml
View file @
747bc5fe
...
...
@@ -165,7 +165,7 @@ end
(* memoization *)
let
memo
?
(
size
=
17
)
f
=
let
memo
_int
size
f
=
let
h
=
Hashtbl
.
create
size
in
fun
x
->
try
Hashtbl
.
find
h
x
with
Not_found
->
let
y
=
f
x
in
Hashtbl
.
add
h
x
y
;
y
...
...
src/util/util.mli
View file @
747bc5fe
...
...
@@ -84,6 +84,8 @@ module Mint : Map.S with type key = int
module
Sstr
:
Set
.
S
with
type
elt
=
string
module
Mstr
:
Map
.
S
with
type
key
=
string
val
memo_int
:
int
->
(
int
->
'
a
)
->
int
->
'
a
(* Set, Map, Hashtbl on structures with a unique tag *)
module
type
Tagged
=
...
...
@@ -118,7 +120,3 @@ sig
module
W
:
Hashweak
.
S
with
type
key
=
X
.
t
end
(* memoization *)
val
memo
:
?
size
:
int
->
(
'
a
->
'
b
)
->
'
a
->
'
b
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