From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA09911; Mon, 6 Jan 2003 18:59:27 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA09905 for ; Mon, 6 Jan 2003 18:59:26 +0100 (MET) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h06HxPr00363 for ; Mon, 6 Jan 2003 18:59:25 +0100 (MET) Received: from ibm3.cicrp.jussieu.fr (ibm3.cicrp.jussieu.fr [134.157.15.3]) by shiva.jussieu.fr (8.12.5/jtpda-5.4) with ESMTP id h06HxPb4027973 for ; Mon, 6 Jan 2003 18:59:25 +0100 (CET) Received: from ibm1.cicrp.jussieu.fr (ibm1.cicrp.jussieu.fr [134.157.15.1]) by ibm3.cicrp.jussieu.fr (8.8.8/jtpda/mob-V8) with ESMTP id SAA44656 for ; Mon, 6 Jan 2003 18:58:13 +0100 Received: from localhost (fernande@localhost) by ibm1.cicrp.jussieu.fr (8.8.8/jtpda/mob-v8) with ESMTP id SAA3506416 for ; Mon, 6 Jan 2003 18:58:13 +0100 Date: Mon, 6 Jan 2003 18:58:13 +0100 (NFT) From: Diego Olivier Fernandez Pons To: caml-list@inria.fr Subject: [Caml-list] =?iso-8859-1?Q?=E9galit=E9_physique_=28=3D=3D=29_avec_Pervasives?= =?iso-8859-1?Q?=2E=28+=29?= Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Antivirus: scanned by sophie at shiva.jussieu.fr Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Bonjour, Je suis en train de pr=E9parer le syst=E8me de description de contraintes pour les algorithmes de descente sur les polyh=E8dres (i.e. simplexe et variantes locales) que l'on utilise dans les approximations de probl=E8mes NP-difficiles J'essaie d'encapsuler le type ['a] dans un type ['a expr] type 'a expr =3D | Constante of 'a | Variable of int | Operateur of 'a expr * 'a expr * ('a -> 'a -> 'a) | Application of 'a expr * ('a -> 'a) let inj =3D function x -> Constante x let inj1 f =3D function expression -> match expression with | Constante v -> Constante f v | Variable _ | Operateur _ | Application _ -> Application (expression, f) let inj2 f =3D fun x y -> match (x, y) with | (Constante s, Constante t) -> Constante (f s t) | _ -> Operateur (x, y, f) val inj : 'a -> 'a expr val inj1 : ('a -> 'a) -> ('a expr -> 'a expr) val inj2 : ('a -> 'a -> 'a) -> ('a expr -> 'a expr -> 'a expr) val eval : 'a env -> 'a expr -> 'a Maintenant je veux traverser la syntaxe abstaite et optimiser le traitement des op=E9rateurs les plus simples (*, +, /, ...) et pour les reconna=EEtre j'utilise l'=E9galit=E9 physique (=3D=3D) Seulement, les op=E9rateurs Pervasive.qqch ne semblent pas se comporter comme les fonctions d=E9finies par l'utilisateur : let f =3D function x -> x + 1 let a =3D (1, f) let (_, g) =3D a f =3D=3D g - : bool =3D true let a =3D (1, (+)) let (_, g) =3D a (+) =3D=3D g - : bool =3D false let a =3D (1, Pervasives.(+)) let (_, g) =3D a Pervasives.(+) =3D=3D g - : bool =3D false Pourquoi ce comportement ? Comment contourner le probl=E8me ? Diego Olivier ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners