Commit 861beeb3 authored by Pietro Abate's avatar Pietro Abate

[r2004-07-08 17:40:46 by cmiachon] adding sum

Original author: cmiachon
Date: 2004-07-08 17:40:46+00:00
parent 7a3e4788
......@@ -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
......@@ -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
......@@ -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 );;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment