Commit a88c3cc8 authored by Pietro Abate's avatar 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 19760485
...@@ -626,20 +626,19 @@ let print_utf8 v = ...@@ -626,20 +626,19 @@ let print_utf8 v =
flush stdout flush stdout
let query_min = function let query_min = function
| Pair(Integer i,p) -> | Pair(i,p) ->
let rec aux l i = match l with let rec aux l i = match l with
| Pair(Integer j,r) -> if (compare (Integer i) (Integer | Pair(j,r) -> if (compare i j <0) then aux r i else aux r j
j) <0) then aux r i else aux r j | Atom(_) -> i
| Atom(_) -> Integer i
| _ -> assert false | _ -> assert false
in aux p i in aux p i
|_ -> assert false |_ -> assert false
let query_max = function let query_max = function
| Pair(Integer i,p) -> | Pair(i,p) ->
let rec aux l i = match l with let rec aux l i = match l with
| Pair(Integer j,r) -> if (compare (Integer i) (Integer | Pair(j,r) -> if (compare i j >0) then aux r i else aux r j
j) >0) then aux r i else aux r j | Atom(_) -> i
| Atom(_) -> Integer i
| _ -> assert false | _ -> assert false
in aux p i in aux p i
|_ -> assert false |_ -> assert false
...@@ -673,6 +672,6 @@ let query_count = function ...@@ -673,6 +672,6 @@ let query_count = function
| Atom a when a = Sequence.nil_atom -> Integer (Intervals.V.from_int 0) | Atom a when a = Sequence.nil_atom -> Integer (Intervals.V.from_int 0)
|_ -> assert false |_ -> assert false
(* todo : sum, avg, min and max [Int+] instead of [Int*] (* todo : sum, avg [Int+] instead of [Int*]
min and max : ne pas se restreindre a Int typage precis pour min et max
*) *)
...@@ -316,10 +316,10 @@ register_fun "raise" any Types.empty ...@@ -316,10 +316,10 @@ register_fun "raise" any Types.empty
(fun v -> raise (Value.CDuceExn v));; (fun v -> raise (Value.CDuceExn v));;
register_fun "min" Sequence.int int register_fun "min" Sequence.any any
(Value.query_min );; (Value.query_min );;
register_fun "max" Sequence.int int register_fun "max" Sequence.any any
(Value.query_max );; (Value.query_max );;
register_fun "sum" Sequence.int int register_fun "sum" Sequence.int int
......
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