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
e143e5ba
Commit
e143e5ba
authored
Oct 05, 2007
by
Pietro Abate
Browse files
[r2004-07-08 17:40:46 by cmiachon] adding sum
Original author: cmiachon Date: 2004-07-08 17:40:46+00:00
parent
1a899f25
Changes
3
Hide whitespace changes
Inline
Side-by-side
runtime/value.ml
View file @
e143e5ba
...
...
@@ -643,3 +643,13 @@ let query_max = function
|
_
->
assert
false
in
aux
p
i
|_
->
assert
false
let
query_sum
=
function
|
Pair
(
Integer
i
,
p
)
->
let
rec
aux
l
i
=
match
l
with
|
Pair
(
Integer
j
,
r
)
->
aux
r
i
+
Intervals
.
V
.
get_int
(
j
)
|
Atom
(
_
)
->
i
|
_
->
assert
false
in
Integer
(
Intervals
.
V
.
from_int
(
aux
p
(
Intervals
.
V
.
get_int
(
i
))))
|_
->
assert
false
runtime/value.mli
View file @
e143e5ba
...
...
@@ -120,3 +120,4 @@ val print_utf8: U.t -> unit
val
query_min
:
t
->
t
val
query_max
:
t
->
t
val
query_sum
:
t
->
t
types/builtin.ml
View file @
e143e5ba
...
...
@@ -321,3 +321,6 @@ register_fun "min" Sequence.int int
register_fun
"max"
Sequence
.
int
int
(
Value
.
query_max
);;
register_fun
"sum"
Sequence
.
int
int
(
Value
.
query_sum
);;
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