Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Snd question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-08-16 (21:51)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Snd question
On Tuesday 16 August 2005 19:16, Richard Jones wrote:
> On Tue, Aug 16, 2005 at 05:34:38PM +0100, Jon Harrop wrote:
> > Currently, you cannot match [|1; ...|] in OCaml.
> Yes!  Or, "prefix" ^ str.

Unless you have a substring type I think that'll have to be: "prefix"^_

Anyway, we've had this discussion before. :-)

> > From my limited experience of SML, it is more of a pain than a benefit.
> It'd be pretty trivial anyway to define the SML #<number> operators
> using camlp4.

Are you sure? I was under the impression that macros didn't know about the 
type system.

Has anyone done any ad-hoc polymorphism (if that's the right jargon, I mean 
the equivalent of "+" for both int and float in SML) for containers? I 
haven't finished it yet but I've recently been playing with a term-level 
mini-Caml interpreter that I was going to add this functionality to. So 
"fold", "map" and so on are built into the language and can be applied to the 
built-in data structures set, list and array. Also, the pattern "1::2::3::_" 
can be applied to any container type.

The main problem that I can think of is the unpredictable memory use of 
substring/subarray types when they keep their "parent" around for longer than 
expected. This makes me think that it might be a bad idea...

Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists