From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA04286; Mon, 27 Sep 2004 18:41:22 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA07144 for ; Mon, 27 Sep 2004 18:41:21 +0200 (MET DST) Received: from mail1.speakeasy.net (mail1.speakeasy.net [216.254.0.201]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i8RGfJmk005984 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 27 Sep 2004 18:41:21 +0200 Received: (qmail 29017 invoked from network); 27 Sep 2004 16:41:16 -0000 Received: from shell2.speakeasy.net ([69.17.110.71]) (envelope-sender ) by mail1.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 27 Sep 2004 16:41:16 -0000 Date: Mon, 27 Sep 2004 09:41:16 -0700 (PDT) From: brogoff To: caml-list Subject: Re: [Caml-list] C++ STL and template features compared with OCaml parametric polymorphism and OO features In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 415842AF.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; brogoff:01 brogoff:01 caml-list:01 generic:01 iterator:01 iterator:01 hofs:01 pointers:01 amusing:01 amusing:01 haskell:01 ocaml:01 ocaml:01 speakeasy:01 sml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, 27 Sep 2004, Brian Hurt wrote: > Two comments: > > First, iterators are usefull in a functional setting, for two reasons. > The first is they allow lazy application of transformations. It's easy to > define a map on an interator to do the transforms as the values get pulled > out. And second, they provide a generic way to plug data structures > together. All you need to write is a to_iterator and from_iterator for > each data structure, and then all data structures can talk to each other. > > Second, you can do fold, map, iter, etc. in C++- it's just a pain. To > emulate HOFs you define a new class with single virtual member function. > The virtual member function then becomes your HOF. Of course, 1 line of > Ocaml code has just become a dozen lines of C++, but that doesn't mean it > can't be done... I've thought for a while that a hybrid of C++, Ada, and Pascal, with the awful C++ syntax fixed, pointers restricted, and especially downward funargs, would be an amusing imperative language, and it would address tha second problem you mention, without requiring GC. But functional languages are more amusing :-). I don't think that iterator based libraries is the right thing in an OCaml (or SML or Haskell) setting. -- Brian ------------------- 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