Article View: comp.lang.c
Article #1428Re: p = {1,0,0}
From: fir
Date: Tue, 10 Nov 2026 14:51
Date: Tue, 10 Nov 2026 14:51
148 lines
5759 bytes
5759 bytes
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
Technical Details
Message-ID:
<11cvb34$27u3i$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>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 15:51:59 +0100
Organization: A noiseless patient Spider
Lines: 148
Message-ID: <11cvb34$27u3i$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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 10 Nov 2026 14:52:21 +0000 (UTC)
Injection-Info: dont-email.me;
logging-data="2357362"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19fnm0cQuN7lZMMRpQjUlxWzf6NUJ+ZchM="; 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:1kf8PCvRcBJeIW4BCUmA28lpdLY= sha256:n97cLAP7zqiIsCOKNpjSYo06Mhg4MFt6gfVnp1bSkHs=
sha1:s861r8bxoHWiklwhMXmrfzoystk= sha256:GCEVZVYtk7/yCYcPPsauu+4loFL8jzZzdC10QvEu2Vo=
In-Reply-To: <11cv9kd$27cfo$1@dont-email.me>