Article View: comp.lang.c
Article #1430Re: p = {1,0,0}
From: fir
Date: Tue, 10 Nov 2026 15:10
Date: Tue, 10 Nov 2026 15:10
214 lines
7816 bytes
7816 bytes
fir pisze:
> bartc pisze:
>> On 10/11/2026 12:51, fir wrote:
>>> bartc pisze:
>>>>
>>>> for i=1,100 {tab[i]=0}
>>>>
>>>>
>>>
>>> this on i dont like better woud be imo
>>>
>>> for i = 1 to 100 {tab[i]=0}
>>>
>>> but still it feels too much basic
>>
>> I'd considered using 1..100 and 1 to 100 but your aim seemed to be
>> conciseness. "1,100" is used in Lua.
>>
>>
>>> there are quite few subtle things here what given form gives what
>>> feelings
>>>
>>> note in c that has no loop there is like no "natural" form of loop
>>> (unles maybe just raw goto etc) at least i dont see it
>>>
>>> this one wth power may be koncidered as somewhat natural
>>>
>>> { } ^ t
>>
>> I once used this:
>>
>> (n || s)
>>
>> for repeat-N-times. I decided that was too quaint.
>>
>> (If a loop were to return a value, as happens in some languages, then
>> such a compact form can be desirable to use within expressions.)
>>
>>> a..b @ i {}
>>>
>>> (i slightly prefer here a..b ^ i {} right now but the exact symbol
>>> choices can be deferred)
>> Have you considered what the construct 'x .. y', if it was part of the
>> syntax, could have lots of different uses. For example:
>>
>> if x in a..b # test a within a range
>> A[i..j] # slicing
>>
>> So it would not be obvious that a..b introduces a loop. I assume that
>> 'a..b @ i {}' means this in my own syntax:
>>
>> for i in a..b do end
>>
>> Which one do you think is clearer? Further, it is possible to do
>>
>> for i in x do end
>>
>> where 'x' might be a range defined elsewhere, or some collection. Now
>> that '..' cue is missing since you'd have to write 'x @ i {}'. But in
>> your next example ...
>>
>>
>>> //i also konsidered
>>>
>>> a..b {tab[%1]=k}
>>
>> the @i is also missing so you basically have:
>>
>> x {}
>>
>> Wasn't this the syntax for your composite struct/function definition?
>>
>>>
>>> //%1 being replcement for i - but i has good tradition in c
>>> // but maybe it could be also present as an alternative solution
>>>
>>> so right now from those considerations the ground im standing
>>> as to loops would be that
>>>
>>> 1..29𝐭{tab[𝐭]=9}
>>>
>>> 1..29 ^ t {tab[t]=9}
>>>
>>> 1..29 {tab[%1]=9}
>>>
>>> // maybe 1..29 ^ {tab[%1]=9}
>>> //maybe ^ t =1..29 {tab[%1]=9}
>>> // alternatively {tab[%1]=9} ^ t= 1..76
>>
>> In practice you don't have many fixed ranges like this; the upper
>> limit is usually tied to the bounds of 'tab', so how would that look?
>> Maybe:
>>
>> for &x in tab {x = 9}
>>
>> where the '&x' means that x is a writeable reference to the element.
>> (C++ might have this.)
>>
>>> //well in combination with power this assigment dont look bad here
>>>
>>> maybe this also?
>>> ^ t=1..29 {tab[t]=9}
>>> allows
>>>
>>> ^ t = {2,7,9,7,2,4,5} {f(t)}
>>>
>>> //allows calls like f(2);f(7);f(9);f(7);f(2); f(4); f(5);
>>
>> This is still just a form of:
>>
>> for x in tab {}
>>
>> For example:
>>
>> for x in (2,7,9,7,2,4,5) {f(x)}
>>
>> But this is more high-level. Just look at some other languages; it's
>> all been done!
>>
>>
>
> its obviously not becouse you dont put those for in loops in places
>
> tab[^{1,3,7,9}] = 'corner';
>
> did they do
>
> tab[for x in {1,3,7,9}] = 'corner';
>
> thet would looks weird..there are abstract differencies in some cyntax
> idea which are not the same as shallow syntax comparisons
>
> in fact it shows shortcut may be eventually used also
>
>
> tab[1,3,7,9] = 'corner';
>
> but thats static case
>
>
> t[] = {1,7,9,3}
>
> tab[t] = 'corner'
>
> could also be used
>
> so in fact indeed some ^ seem not mandatory
>
>
note becouse this is important to realize:
is some has some deeper "behind a syntax" observations
then aspects of those abservations may open som enew pathes in code
thinking tha just shallowly comparing syntaxes (and not realizing the
"behind" side dfferences which are kinda invisible (untill youre very
good in all that, bein able to catch and compare this invisible "behind"
side ideas)
you may say X looks like other X (ehere X is piece of some syntax) - it
looks very close or it even may just look the same
if thhere are other ideas on "behind" sides of one X and other X
they are not he same - especially if one X with its behind ideas opens
some new syntax gates/corridors/pathes for things
right now after those combinations/considerations it seems:
to get a loop in c you must
"multiply or power" given block of code with "range or list"
(as i said its rather power but is kinda abstract power so i some way
one could also say its abstract operation of multiply, and in common
language if some has
"block" X "range"
"block" X "list"
some can say imo multiply some can say "power to" depending what is more
convenient (i the context of those sentence multiply fits, normally imo
power more fits, but both somewhat fits)
so
tab[2..88] this is a loop (as tab is multipied by range or powered by range)
tab[t] -if t is array - is also a loop (of size of length of t)
tab[2,36,7,3,2,4,5] - is aloso a loop (t turns)
tab[i] would be loop if i is scope/range, if i is sole value its not a loop
so ine can evenylually say that if i is value say 100 some can use ^ to
turn it into scope/range
int i = 0..100;
tab[i]=0; //loop (101 turns)
int i=100;
tab[i] = 0;// not loop
tab[^i] ; //loop (100 turns)
all that abstract powering ideas lead to that
Technical Details
Message-ID:
<11cvc5l$28a7s$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11c7f1j$20b9h$1@dont-email.me> <11c7fj6$20gab$1@dont-email.me> <11cae5m$318tq$1@dont-email.me> <11calrt$34gq3$1@dont-email.me> <11carqs$36m0o$1@dont-email.me> <11cb4hs$3a13l$1@dont-email.me> <11ccnkq$3pjhd$1@dont-email.me> <11ccobd$3ps4l$1@dont-email.me> <11cctee$3rtjh$1@dont-email.me> <11ccu0t$3s54f$1@dont-email.me> <11ccv4n$3sjn5$1@dont-email.me> <11cd05l$3t1er$1@dont-email.me> <11cd0q3$3ta28$1@dont-email.me> <11cd1vs$3tpfp$1@dont-email.me> <11cnve1$3ofei$1@dont-email.me> <11co8d4$3rpvm$1@dont-email.me> <14be9ea5-918f-5871-1bba-11e29e6e25d5@gmail.com> <11coqot$1236$1@dont-email.me> <11cplsf$8nc4$1@dont-email.me> <11cpnbb$97kp$1@dont-email.me> <11cpo21$9fji$1@dont-email.me> <11cpov5$9q2h$1@dont-email.me> <11cq3hb$dnf9$1@dont-email.me> <11ctijh$1mb1u$1@dont-email.me> <11ctr0o$1or07$1@dont-email.me> <11cv41a$2582a$1@dont-email.me> <11cv9kd$27cfo$1@dont-email.me> <11cvb34$27u3i$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: fir <profesor.fir@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: p = {1,0,0}
Date: Tue, 10 Nov 2026 16:10:24 +0100
Organization: A noiseless patient Spider
Lines: 214
Message-ID: <11cvc5l$28a7s$1@dont-email.me>
References: <11c7f1j$20b9h$1@dont-email.me> <11c7fj6$20gab$1@dont-email.me>
<11cae5m$318tq$1@dont-email.me> <11calrt$34gq3$1@dont-email.me>
<11carqs$36m0o$1@dont-email.me> <11cb4hs$3a13l$1@dont-email.me>
<11ccnkq$3pjhd$1@dont-email.me> <11ccobd$3ps4l$1@dont-email.me>
<11cctee$3rtjh$1@dont-email.me> <11ccu0t$3s54f$1@dont-email.me>
<11ccv4n$3sjn5$1@dont-email.me> <11cd05l$3t1er$1@dont-email.me>
<11cd0q3$3ta28$1@dont-email.me> <11cd1vs$3tpfp$1@dont-email.me>
<11cnve1$3ofei$1@dont-email.me> <11co8d4$3rpvm$1@dont-email.me>
<14be9ea5-918f-5871-1bba-11e29e6e25d5@gmail.com>
<11coqot$1236$1@dont-email.me> <11cplsf$8nc4$1@dont-email.me>
<11cpnbb$97kp$1@dont-email.me> <11cpo21$9fji$1@dont-email.me>
<11cpov5$9q2h$1@dont-email.me> <11cq3hb$dnf9$1@dont-email.me>
<11ctijh$1mb1u$1@dont-email.me> <11ctr0o$1or07$1@dont-email.me>
<11cv41a$2582a$1@dont-email.me> <11cv9kd$27cfo$1@dont-email.me>
<11cvb34$27u3i$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 10 Nov 2026 15:10:46 +0000 (UTC)
Injection-Info: dont-email.me;
logging-data="2369788"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mIcR9FXCDBI1yruNahPoS6Qf1xYJNtVU="; posting-host="5e24ef116842e5f7dade8922bc1e4cca"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101
Firefox/140.0 SeaMonkey/2.53.24
Cancel-Lock: sha1:BbWvDOohMuwHQmMaop9rHyat4fo= sha256:fIl7hiqxygiUqVz6W69KbmZOPV4y8yS/FZx1yoQb6rI=
sha1:OHsqxBqvYNIoaoju1zHkMosU+x0= sha256:YNkVxieZ4KpUKzrXV1IaBzyqDYUe0xBDO2zahV0A554=
In-Reply-To: <11cvb34$27u3i$1@dont-email.me>