Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #1913

Re: repeating something n times

From "BartC" <bc@freeuk.com>
Newsgroups comp.programming
Subject Re: repeating something n times
Date 2012-07-06 23:18 +0100
Organization A noiseless patient Spider
Message-ID <jt7ob3$u6v$1@dont-email.me> (permalink)
References <repeat-20120705210751@ram.dialup.fu-berlin.de><jt7jdv$247$1@dont-email.me> <0.277bb5835853450903f1.20120706221628BST.87ehooa8ur.fsf@bsb.me.uk>

Show all headers | View raw



"Ben Bacarisse" <ben.usenet@bsb.me.uk> wrote in message
news:0.277bb5835853450903f1.20120706221628BST.87ehooa8ur.fsf@bsb.me.uk...
> "BartC" <bc@freeuk.com> writes:
>
>> "Stefan Ram" <ram@zedat.fu-berlin.de> wrote in message
>> news:repeat-20120705210751@ram.dialup.fu-berlin.de...
>>>  It is funny how many languages fail to give a means to
>>>  repeat something n times.
> <snip>
>> Some languages just don't seem to like syntax! Any syntax of mine
>> *always*
>> has a construction for infinite loops, followed by one for N-times loops,
>> even before there are indexed for-loops and while, repeat and so on. They
>> are just fundamental. However, C-derived syntaxes rarely seem to add
>> anything to the basic loop form from four decades ago.
>
> When I think of C-derived syntaxes, C++, Objective C, C# and Java spring
> to mind, but all of these have added things to the basic loop form (the
> most useful being loops over collections).  I am sure there are
> C-derived syntaxes that have *not* added anything to C's basic loop
> forms (though I'm drawing blank at the moment), but I think they are the
> rare ones -- at least in terms of usage.

C++, C#, Java and Go (and Javascript, PHP, Perl...) all seem to retain the
original C for-loop.

They might also have foreach/forall (and I use those as well), and there
might be other advanced ways to iterate over things that needn't involve an
explicit loop at all (so that it's importance is diminished), but I consider
those a little different.

By 'adding' to the original C multi-purpose for-statement, I meant having
streamlined or dedicated versions for a counted repeat, or a simple 
iteration over a range of integers. As I said such versions seem to be rare.

(For example, a counted repeat needs three things specified: (1) the thing 
to be repeated; (2) the count; and (3) something to say this is such a loop, 
usually some syntax linking (1) and (2). Currently C needs rather more than 
3 things to be supplied!)

-- 
bartc 

Back to comp.programming | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: repeating something n times "BartC" <bc@freeuk.com> - 2012-07-06 21:56 +0100
  Re: repeating something n times Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-07-06 22:16 +0100
    Re: repeating something n times "BartC" <bc@freeuk.com> - 2012-07-06 23:18 +0100
  Re: repeating something n times malcolm.mclean5@btinternet.com - 2012-07-14 14:11 -0700
    Re: repeating something n times "BartC" <bc@freeuk.com> - 2012-07-14 23:11 +0100
      Re: repeating something n times Ike Naar <ike@iceland.freeshell.org> - 2012-07-14 23:37 +0000
        Re: repeating something n times "BartC" <bc@freeuk.com> - 2012-07-15 01:16 +0100
          Re: repeating something n times malcolm.mclean5@btinternet.com - 2012-07-14 17:35 -0700
            Re: repeating something n times Aaron W. Hsu <arcfide@sacrideo.us> - 2012-07-14 22:23 -0500
          Re: repeating something n times Aaron W. Hsu <arcfide@sacrideo.us> - 2012-07-14 22:19 -0500
            Re: repeating something n times "BartC" <bc@freeuk.com> - 2012-07-15 11:00 +0100
      Re: repeating something n times malcolm.mclean5@btinternet.com - 2012-07-14 17:44 -0700
      Re: repeating something n times Aaron W. Hsu <arcfide@sacrideo.us> - 2012-07-14 22:17 -0500
        Re: repeating something n times "BartC" <bc@freeuk.com> - 2012-07-15 11:49 +0100
          Re: repeating something n times Aaron W. Hsu <arcfide@sacrideo.us> - 2012-07-15 09:53 -0500
      Re: repeating something n times Rui Maciel <rui.maciel@gmail.com> - 2012-07-15 12:18 +0100
        Re: repeating something n times "BartC" <bc@freeuk.com> - 2012-07-15 13:21 +0100
          Re: repeating something n times Willem <willem@toad.stack.nl> - 2012-07-15 13:02 +0000
            Re: repeating something n times "BartC" <bc@freeuk.com> - 2012-07-15 14:36 +0100
              Re: repeating something n times Willem <willem@toad.stack.nl> - 2012-07-15 14:18 +0000
                Re: repeating something n times "BartC" <bc@freeuk.com> - 2012-07-15 15:45 +0100
                Re: repeating something n times Willem <willem@toad.stack.nl> - 2012-07-15 16:25 +0000
                Re: repeating something n times "BartC" <bc@freeuk.com> - 2012-07-15 18:02 +0100
          Re: repeating something n times Rui Maciel <rui.maciel@gmail.com> - 2012-07-15 15:10 +0100
            Re: repeating something n times "BartC" <bc@freeuk.com> - 2012-07-15 16:10 +0100
              Re: repeating something n times malcolm.mclean5@btinternet.com - 2012-07-15 13:00 -0700
    Re: repeating something n times Aaron W. Hsu <arcfide@sacrideo.us> - 2012-07-14 21:55 -0500
      Re: repeating something n times "io_x" <a@b.c.invalid> - 2012-07-17 20:47 +0200
        Re: repeating something n times "io_x" <a@b.c.invalid> - 2012-07-18 14:19 +0200
          Re: repeating something n times Aaron W. Hsu <arcfide@sacrideo.us> - 2012-07-18 12:55 -0500
            Re: repeating something n times malcolm.mclean5@btinternet.com - 2012-07-18 11:57 -0700

csiph-web