<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2002/07/e34cafa33a7d9b8d542ed3b6c2a034d4"
  from="Nicolas FRANCOIS &lt;nicolas.francois@f...&gt;"
  author="Nicolas FRANCOIS"
  date="2002-07-04T23:54:23"
  subject="Re: [Caml-list] Objects or modules ?"
  prev="2002/07/efbccf2948fc97802e181fc5bfd67f65"
  next="2002/07/cbec09021d56233041ce70f8aa3b40da"
  prev-in-thread="2002/07/cba22a6889e4519e882d4ef4c384fd14"
  prev-thread="2002/06/2f06726dec7ab299cbcd92b4eb602296"
  next-thread="2002/06/a545216e545c24d6dd77ca80d998d71f"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Objects or modules ?">
<msg 
  url="2002/06/50bf476e96f83c1a09039d54e2b11424"
  from="Nicolas FRANCOIS &lt;nicolas.francois@f...&gt;"
  author="Nicolas FRANCOIS"
  date="2002-06-29T01:06:48"
  subject="[Caml-list] Objects or modules ?">
<msg 
  url="2002/07/4a2d36c0bcad337be8321968719e2efd"
  from="Nicolas FRANCOIS &lt;nicolas.francois@f...&gt;"
  author="Nicolas FRANCOIS"
  date="2002-07-01T01:10:57"
  subject="Re: [Caml-list] Objects or modules ?">
</msg>
<msg 
  url="2002/07/9ae5bda85caec3e5e6a0f5988c05d8db"
  from="Francois Pottier &lt;francois.pottier@i...&gt;"
  author="Francois Pottier"
  date="2002-07-02T17:24:24"
  subject="Re: [Caml-list] Objects or modules ?">
</msg>
<msg 
  url="2002/06/50a4ce1c89f70c809a98d6f62b7fda15"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-06-29T06:54:59"
  subject="Re: [Caml-list] Objects or modules ?">
<msg 
  url="2002/06/d97aa6e9d1b9c855e486911430bb90ae"
  from="Blair Zajac &lt;blair@o...&gt;"
  author="Blair Zajac"
  date="2002-06-30T06:45:58"
  subject="Re: [Caml-list] Objects or modules ?">
</msg>
</msg>
<msg 
  url="2002/06/3d20e1e91daaae8d3c2f51f4f4c90063"
  from="Markus Mottl &lt;markus@o...&gt;"
  author="Markus Mottl"
  date="2002-06-29T10:23:00"
  subject="Re: [Caml-list] Objects or modules ?">
<msg 
  url="2002/07/cba22a6889e4519e882d4ef4c384fd14"
  from="Nicolas FRANCOIS &lt;nicolas.francois@f...&gt;"
  author="Nicolas FRANCOIS"
  date="2002-07-03T23:08:07"
  subject="Re: [Caml-list] Objects or modules ?">
<msg 
  url="2002/07/e34cafa33a7d9b8d542ed3b6c2a034d4"
  from="Nicolas FRANCOIS &lt;nicolas.francois@f...&gt;"
  author="Nicolas FRANCOIS"
  date="2002-07-04T23:54:23"
  subject="Re: [Caml-list] Objects or modules ?">
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
Le Thu, 4 Jul 2002 01:16:11 +0200 Nicolas FRANCOIS (AKA El Bofo)
&lt;nicolas.francois@free.fr&gt; a écrit :

&gt; Le Sat, 29 Jun 2002 12:22:52 +0200 Markus Mottl &lt;markus@oefai.at&gt; a
&gt; écrit:
&gt; 
&gt; &gt; You might also want to take a look at Christophe Raffalli's library
&gt; &gt; for formal and numerical calculus to grab a few ideas:
&gt; &gt; 
&gt; &gt;   http://lama-d134.univ-savoie.fr/sitelama/Membres/pages_web/RAFFALLI/formel.html
&gt; 
&gt; OK, I got it. If I really understand this, this is a pre-project for
&gt; FOC. Am I right ?
&gt; 
&gt; Now that I adapted it to OCaml 3.04 (Streams not recognized by standard
&gt; OCaml now), I have a new problem : this is a definition for a quotient
&gt; ring (there's a similar one for a quotient field in case the ideal is
&gt; primitive) ;
&gt; 
&gt; (in algebra.mli)
&gt; module Quotient :
&gt;   functor(R : Euclidian_Ring) -&gt;
&gt;     functor(Elt : One_element with type elem = R.elem) -&gt;
&gt;       Ring with type elem = R.elem
&gt;   
&gt; (in algebra.ml)
&gt; module Quotient = 
&gt;   functor (R : Euclidian_Ring) -&gt; 
&gt;   functor (Elt : One_element with type elem = R.elem) -&gt;
&gt;   struct
&gt;     type elem = R.elem
&gt;     let zero = R.zero
&gt;     let one = R.one
&gt;     let t_of_int = R.t_of_int
&gt;     let (++) = R.(++)
&gt;     let (--) = R.(--)
&gt;     let ( ** ) = R.( ** )
&gt;     let (==) a b = R.(==) (R.(mod) (R.(--) a b) Elt.elt) R.zero
&gt;     let opp = R.opp
&gt;     let normalize x = R.(mod) (R.normalize x) Elt.elt
&gt;     let print x = R.print (normalize x)
&gt;     let write ch x = R.write ch (normalize x)
&gt;     let parse = R.parse
&gt;     let read = R.read
&gt;     let write_bin ch x = R.write_bin ch (normalize x)
&gt;     let read_bin = R.read_bin
&gt;     let conjugate = R.conjugate
&gt;   end
&gt; 
&gt; I'd like to use this functor to create a ring Z/pZ, providing a
&gt; (possibliy prime) integer p. My problem is : what is the correct way to
&gt; use this ?

OK, I found a way : 

(file essai.ml)
open Algebra

module Five : (One_element with type elem = Ring_MZ.elem) =
  struct
    type elem = Ring_MZ.elem
    let elt = Ring_MZ.t_of_int 5
  end
open Five

module Z5Z = Quotient_prime (Ring_MZ) (Five)

open Polynomial

module P = Make(Z5Z)

open P

let p1 = monome (Z5Z.t_of_int 8) 0
	 ++ monome (Z5Z.t_of_int 4) 1
	 ++ monome (Z5Z.t_of_int 1) 2;;
	   
let p2 = monome (Z5Z.t_of_int 3) 1
	 ++ monome (Z5Z.t_of_int 1) 12
	 ++ monome (Z5Z.t_of_int 2) 14;;

print (p1 ** (p2 // p1) ++ (p2 mod p1) -- p2)


(The end for the ones how know the package Formel)

Is there a way to do things simpler ?

\bye


-- 

                   Nicolas FRANCOIS
            http://nicolas.francois.free.fr
 A TRUE Klingon programmer does NOT comment his code
-------------------
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

</contents>

</message>

