Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #1964
| Newsgroups | comp.programming |
|---|---|
| Subject | Re: repeating something n times |
| References | (1 earlier) <jt7jdv$247$1@dont-email.me> <b73472b3-9e35-45e4-b9cf-ab8366f4e770@googlegroups.com> <jtsqtf$q73$2@dont-email.me> <R-ydnZ86Os78q5_NnZ2dnUVZ_hSdnZ2d@giganews.com> <pgxMr.866349$ME5.164830@fx22.am4> |
| From | Aaron W. Hsu <arcfide@sacrideo.us> |
| Message-ID | <7eCdnc2DmtjORJ_NnZ2dnUVZ_q6dnZ2d@giganews.com> (permalink) |
| Date | 2012-07-15 09:53 -0500 |
"BartC" <bc@freeuk.com> writes: >"Aaron W. Hsu" <arcfide@sacrideo.us> wrote in message >news:R-ydnZ86Os78q5_NnZ2dnUVZ_hSdnZ2d@giganews.com... >> As noted elsewhere, it's not clear whether repeat (4) is meant to be >> doing four times or whether it is repeating up to, but not including 4. >Your thinking is zero-based. That languages I create are one-based. (That >also means certain types of loops are awkward in languages such as C which >like to count 0 to N-1.) My main point is that the pattern 'for (i = 0; i < N; i++)' is not inherently more difficult to understand as a pattern than 'repeat (N)'. Maybe there are more technical opportunities to make mistakes in typing, but if you view the above as a pattern, something that has much more syntactic constraint on it than C's technical restrictions, then its not nearly so bad. Programmers don't read that for loop in the literal semantics of C, but it maps directly to 'iteration over N values' or some equivalent. Now, they had to learn that, somehow, but they would also have to learn how 'repeat (N)' works, and my main point is that these are not inherently cognitively harder to grasp. My main programming languages are C, Scheme, and APL. Three very different languages, with different means of abstraction. They each take time to learn well, and each of them has warts and quirks. Each provides abstractions facilities differen than the others, and I often find that I like to use one over the other because those abstractions in that language fit better to the problem I am working on. IMO, C's lack of a good syntactic abstraction mechanism makes the issue of looping constructs more of an issue, whereas in Scheme they are a non-issue, because you have infinitely many as you want. APL side-steps the problem entirely (including that of index origin) by changing the way you need to think about the problem, making explicit looping something you avoid, rather than making it the main course. The tradeoff in C's simplicity and level of abstraction is that some operations are represented by more tokens, with more explicit book keeping, but that is not necessarily a negative. -- Aaron W. Hsu | arcfide@sacrideo.us | http://www.sacrideo.us Programming is just another word for the lost art of thinking.
Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar
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