Version française
Home     About     Download     Resources     Contact us    
Browse thread
declaration of an infix operator in a .mli file
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Laurent Chéno <lcheno@c...>
Subject: declaration of an infix operator in a .mli file
Sorry : poor-english version at the end of this message.


Dans foo.ml, j'ai les définitions suivantes de nouveaux opérateurs infixes :

(***)
let epsilon = 1.0e-4 ;;

let (prefix =?) = fun x y -> abs_float (x -. y) <. epsilon
and (prefix <?) = fun x y -> x <. y +. epsilon
and (prefix >?) = fun x y -> y <. x +. epsilon ;;
(***)

Quel fichier foo.mli dois-je écrire pour les exporter ?

Et, au fait, pourquoi

let (prefix =?) x y = abs_float (x -. y) <. epsilon ;;

est-il incorrect ? (J'obtiens une Erreur de syntaxe.)

Cordialement, Laurent Chéno

----

I wrote this litte file foo.ml :

(***)
let epsilon = 1.0e-4 ;;

let (prefix =?) = fun x y -> abs_float (x -. y) <. epsilon
and (prefix <?) = fun x y -> x <. y +. epsilon
and (prefix >?) = fun x y -> y <. x +. epsilon ;;
(***)

I do'nt know write the file foo.mli.

Another question :  why is the following wrong ?

let (prefix =?) x y = abs_float (x -. y) <. epsilon ;;

(I obtain a Syntax error)