caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* module aggregation
@ 1996-06-13  7:09 Franck Delaplace
  1996-06-14 10:25 ` Wolfgang Lux
  0 siblings, 1 reply; 3+ messages in thread
From: Franck Delaplace @ 1996-06-13  7:09 UTC (permalink / raw)
  To: caml-list


I want to aggregate two modules in one in order
to improve some standard modules or some module
define by functors . How can I do this in Ocaml ? 

for instance I want to have a function 
which gives a list of cartesian product of l1 l2 

let cartesian_map  f l1 l2 = List.flatten (List.map (fun(a)-> List.map (f a) l2) l1);;

val cartesian_map : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list = <fun>

and I would like to call it  List.cartesian_map 


I have also the same problem for module defined by Functor
I want to add some specific functions once the module is defined.

Thank you 

--- 

Franck Delaplace.	Tel: +33 (1) 6947 7463	email : delapla@lami.univ-evry.fr 

LAboratoire de Mathematiques et d'Informatique (LAMI)
Equipe Parallelisme  (http://perdiguier.univ-evry.fr:8004/parall/)
 
Universite d'Evry Val d'Essonne                                                 
Cours Monseigneur Romero
91025 EVRY CEDEX (FRANCE)





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: module aggregation
  1996-06-13  7:09 module aggregation Franck Delaplace
@ 1996-06-14 10:25 ` Wolfgang Lux
  1996-06-14 22:00   ` Bernd Grobauer
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Lux @ 1996-06-14 10:25 UTC (permalink / raw)
  To: Franck Delaplace; +Cc: caml-list


Franck Delaplace <delapla@lami.univ-evry.fr> writes:
> 
> I want to aggregate two modules in one in order
> to improve some standard modules or some module
> define by functors . How can I do this in Ocaml ? 
> 

This answer is very simple: You cannot.

The only way to achieve your goal would be to define a new module,
copy all values of the module M1 you want to preserve and then add or
change those values which you do not want to include from M1 or add to
M1.

> I have also the same problem for module defined by Functor
> I want to add some specific functions once the module is defined.
> 

There's no way to do that. You have to recompile the functor. (After
all we are not in Smalltalk here.)

Regards
Wolfgang

----
Wolfgang Lux
WZH Heidelberg, IBM Germany             Internet: lux@heidelbg.ibm.com
+49-6221-59-4546                        VNET:     LUX at HEIDELBG
+49-6221-59-3500 (fax)	                EARN:     LUX at DHDIBMIP





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: module aggregation
  1996-06-14 10:25 ` Wolfgang Lux
@ 1996-06-14 22:00   ` Bernd Grobauer
  0 siblings, 0 replies; 3+ messages in thread
From: Bernd Grobauer @ 1996-06-14 22:00 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 1025 bytes --]

Wolfgang Lux <lux@heidelbg.ibm.com> writes:
>
>> I want to aggregate two modules in one in order
>> to improve some standard modules or some module
>> define by functors . How can I do this in Ocaml ? 
>> 
>
>This answer is very simple: You cannot.
>
>The only way to achieve your goal would be to define a new module,
>copy all values of the module M1 you want to preserve and then add or
>change those values which you do not want to include from M1 or add to
>M1.

Some time ago I was wondering about something kind of equivalent to this problem, regarding module
types:   including an already defined module type in order to keep module types more
readable,  instead of copying all the definitions already made. For example in ML
I could write something like

module type ExtendedList =
 sig
   include ListType
   split::  ('a -> boole) -> 'a list -> 'alist * 'alist
end;;

There is no such thing include in the OCAML-language. Is this because it is incompatible with the type system?

Bernd

[-- Attachment #2: Type: text/enriched, Size: 1072 bytes --]

Wolfgang Lux <<lux@heidelbg.ibm.com> writes:

>

>> I want to aggregate two modules in one in order

>> to improve some standard modules or some module

>> define by functors . How can I do this in Ocaml ? 

>> 

>

>This answer is very simple: You cannot.

>

>The only way to achieve your goal would be to define a new module,

>copy all values of the module M1 you want to preserve and then add or

>change those values which you do not want to include from M1 or add to

>M1.


Some time ago I was wondering about something kind of equivalent to this problem, regarding module

types:   including an already defined module type in order to keep module types more

readable,  instead of copying all the definitions already made. For example in ML

I could write something like


module type ExtendedList =

 sig

   include ListType

   split::  ('a -> boole) -> 'a list -> 'alist * 'alist

end;;


There is no such thing include in the OCAML-language. Is this because it is incompatible with the type system?


Bernd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-06-17 17:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-13  7:09 module aggregation Franck Delaplace
1996-06-14 10:25 ` Wolfgang Lux
1996-06-14 22:00   ` Bernd Grobauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).