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 PAA27730; Mon, 27 Sep 2004 15:32:22 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA30406 for ; Mon, 27 Sep 2004 15:32:21 +0200 (MET DST) Received: from mproxy.gmail.com (rproxy.gmail.com [64.233.170.201]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i8RDWKML010539 for ; Mon, 27 Sep 2004 15:32:21 +0200 Received: by mproxy.gmail.com with SMTP id 79so3178526rnk for ; Mon, 27 Sep 2004 06:32:20 -0700 (PDT) Received: by 10.38.171.13 with SMTP id t13mr75716rne; Mon, 27 Sep 2004 06:32:19 -0700 (PDT) Received: by 10.38.75.19 with HTTP; Mon, 27 Sep 2004 06:32:18 -0700 (PDT) Message-ID: <7f8e92aa040927063254825e34@mail.gmail.com> Date: Mon, 27 Sep 2004 16:32:18 +0300 From: Radu Grigore Reply-To: Radu Grigore To: Jon Harrop Subject: Re: [Caml-list] C++ STL and template features compared with OCaml parametric polymorphism and OO features Cc: caml-list In-Reply-To: <200409271411.30384.jon@jdh30.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20040925225246.48566.qmail@web53010.mail.yahoo.com> <200409270259.43863.jon@jdh30.plus.com> <7f8e92aa0409270350ce0eed2@mail.gmail.com> <200409271411.30384.jon@jdh30.plus.com> X-Miltered: at nez-perce with ID 41581664.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 2004:99 iterator:01 iterator:01 abstraction:01 generic:01 ocaml:01 sep:01 iterators:02 iterators:02 wrote:03 stl:03 data:03 functions:05 equivalent:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, 27 Sep 2004 14:11:30 +0100, Jon Harrop wrote: > > For the writter of the function there is a big difference, especially > > if it has to write the specialized versions. > > The equivalent to the writer of fold is the writer of an iterator. You have to > write specialized versions for each type of iterator just as you would have > to write your own fold. That's why I said iterators are another level of abstraction. The difference is that after you write the iterators code for a new sequence-like data structure all the "generic" functions, not only fold but also map and others, will automagically work on them. The simplest form of an "iterator" is implementing a "next" function for all sequences (although in this situation it is more of an "enumeration"). regards, radu ------------------- 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