Version française
Home     About     Download     Resources     Contact us    
Browse thread
local opening
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre CASTERAN <Pierre.Casteran@l...>
Subject: local opening


 Hello,

 Is it possible to open a module inside a single expression ?

 I tried :


module  Compl=
  struct
    type compl=float*float

    let compl(r:float)=(r,0.0)

    let i=(0.0,1.0)

    let add(((a,b):compl),((a',b'):compl))=
         (a+.a',b+.b')

    let mult(((a,b):compl),((a',b'):compl))=
         (a*.a'-.b*.b',a*.b'+.b*.a')
  end;;

let open Compl 
  in mult(i,i);;

but it produced a syntax error .

Is it possible to avoid an heavy :

Compl.mult(Compl.i,Compl.i);;

or a (global) opening of Compl ?


Best regards,

Pierre