Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
3f1a2809
Commit
3f1a2809
authored
Oct 05, 2007
by
Pietro Abate
Browse files
[r2004-07-08 18:24:48 by cmiachon] Empty log message
Original author: cmiachon Date: 2004-07-08 18:24:48+00:00
parent
4462e1ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
runtime/value.ml
View file @
3f1a2809
...
...
@@ -626,20 +626,19 @@ let print_utf8 v =
flush
stdout
let
query_min
=
function
|
Pair
(
Integer
i
,
p
)
->
|
Pair
(
i
,
p
)
->
let
rec
aux
l
i
=
match
l
with
|
Pair
(
Integer
j
,
r
)
->
if
(
compare
(
Integer
i
)
(
Integer
j
)
<
0
)
then
aux
r
i
else
aux
r
j
|
Atom
(
_
)
->
Integer
i
|
Pair
(
j
,
r
)
->
if
(
compare
i
j
<
0
)
then
aux
r
i
else
aux
r
j
|
Atom
(
_
)
->
i
|
_
->
assert
false
in
aux
p
i
|_
->
assert
false
let
query_max
=
function
|
Pair
(
Integer
i
,
p
)
->
|
Pair
(
i
,
p
)
->
let
rec
aux
l
i
=
match
l
with
|
Pair
(
Integer
j
,
r
)
->
if
(
compare
(
Integer
i
)
(
Integer
j
)
>
0
)
then
aux
r
i
else
aux
r
j
|
Atom
(
_
)
->
Integer
i
|
Pair
(
j
,
r
)
->
if
(
compare
i
j
>
0
)
then
aux
r
i
else
aux
r
j
|
Atom
(
_
)
->
i
|
_
->
assert
false
in
aux
p
i
|_
->
assert
false
...
...
@@ -673,6 +672,6 @@ let query_count = function
|
Atom
a
when
a
=
Sequence
.
nil_atom
->
Integer
(
Intervals
.
V
.
from_int
0
)
|_
->
assert
false
(* todo : sum, avg
, min and max
[Int+] instead of [Int*]
min and max : ne pas s
e re
streindre a Int
(* todo : sum, avg [Int+] instead of [Int*]
typag
e
p
re
cis pour min et max
*)
types/builtin.ml
View file @
3f1a2809
...
...
@@ -316,10 +316,10 @@ register_fun "raise" any Types.empty
(
fun
v
->
raise
(
Value
.
CDuceExn
v
));;
register_fun
"min"
Sequence
.
int
int
register_fun
"min"
Sequence
.
any
any
(
Value
.
query_min
);;
register_fun
"max"
Sequence
.
int
int
register_fun
"max"
Sequence
.
any
any
(
Value
.
query_max
);;
register_fun
"sum"
Sequence
.
int
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