English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] ANN: ChartPak - a data visualization library for the web
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-01-24 (12:02)
From: Michal Moskal <malekith@p...>
Subject: Re: [Caml-list] Baby Steps (was: ChartPak - a data visualization library for the web)
On Thu, Jan 23, 2003 at 11:19:59PM -0500, Oleg wrote:
> On Monday 20 January 2003 03:37 pm, Brian Hurt wrote:
> > The trend here is that the mainstream only takes baby steps.
> If someone merely added
> - ADTs
> - variant types
> - GC
> - strict[er] typing
> - and perhaps polymorphism
> to C, I wonder if such a language would take off.

Take a look at http://www.research.att.com/projects/cyclone/ and
<advertise> http://gont.pld.org.pl/ </advertise>.

But if you want to know my opinion... I designed such a language, wrote
compiler for it in OCaml, rewrote compiler in this language (getting
it to bootstrap was a lot of fun :-), and finally coded something else
(kind of extended lambda calculus interpreter) in OCaml. And the final
impression was: it's far easier in OCaml. The main difference between
OCaml (the part that I was using) and Gont was syntax.  And OCaml syntax
is better, once you get used to FP. For example:

<'b>list map(*('b ('a)) f, <'a>list l)
        switch l {
        case Nil: return Nil;
        case Cons(hd, tl): return Cons(f(hd), map(f, tl));

Or version using type inference:

def map2(f, l)
        switch l {
        case Nil: return Nil;
        case Cons(hd, tl): return Cons(f(hd), map2(f, tl));

And now in OCaml

let rec map f = function
  | [] -> []
  | x :: xs -> f x :: map f xs

: Michal Moskal ::::: malekith/at/pld-linux.org :  GCS {C,UL}++++$ a? !tv
: PLD Linux ::::::: Wroclaw University, CS Dept :  {E-,w}-- {b++,e}>+++ h
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