From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA05708 for caml-redistribution; Mon, 14 Dec 1998 09:47:24 +0100 (MET) 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 QAA01529 for ; Fri, 11 Dec 1998 16:16:24 +0100 (MET) Received: from mail5.microsoft.com (mail5.microsoft.com [131.107.3.121]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id QAA02408 for ; Fri, 11 Dec 1998 16:16:22 +0100 (MET) Received: by INET-IMC-05 with Internet Mail Service (5.5.2232.9) id ; Fri, 11 Dec 1998 07:16:21 -0800 Message-ID: <39ADCF833E74D111A2D700805F1951EF0B2EF6D1@RED-MSG-06> From: Don Syme To: "'John Whitley'" , caml-list@inria.fr Subject: RE: for loops with stride Date: Fri, 11 Dec 1998 07:16:18 -0800 X-Mailer: Internet Mail Service (5.5.2232.9) Sender: weis > On a hopefully less controversial note, I'd like to make a suggestion > for an addition to OCaml for-loops. Consider an optional stride > parameter, as in: > > for i = 0 to n-1 by stride do > ... > done Well, this will no doubt bring controversy, but why not extend the syntax to allow more general for loops? E.g. for (i=0; i ; not (null i); i <- tl i) do print i; done; and for one-off iteration strategies I would probably prefer this anyway, e.g. for (i= ; not (null i) & not (null(tl i)); i <- tl(tl i)) do print i; done; doesn't really deserve a special higher-order iterator. Ex-C programmers would certainly like this, at least until they got into the higher-order swing of things, and it seems pretty declarative to me. Don ------------------------------------------------------------------------ At the lab: At home: Microsoft Research Cambridge 11 John St St George House CB1 1DT Cambridge, CB2 3NH, UK Ph: +44 (0) 1223 744797 Ph: +44 (0) 1223 722244 http://research.microsoft.com/users/dsyme email: dsyme@microsoft.com "You've been chosen as an extra in the movie adaptation of the sequel to your life" -- Pavement, Shady Lane ------------------------------------------------------------------------