1. RE: Why 'for', not 'from' ?
- Posted by Al Getz <Xaxo at aol.com> Jun 02, 2003
- 391 views
Igor Kachan wrote: > > > Dear EU users: > > There is well known "for loop" in most of > programming languages. > > But why it is "for", not "from" ? > > Say, the below construction seems to be much > more clear than standard one : > > from i=1 to 100 do > ---- > end from > > > for i=1 to 100 do > ---- > end for > > Or, maybe, that programmer was not the > English programmer, but a great Mumbo-Jumbo one ? > > Or, maybe, my Muller's dictionary is not so good > about the main words ? > > Regards, > Igor Kachan > kinz at peterlink.ru > > Hello there Igor, for x=1 to 10 do end for The range starts at 1, not at x. x takes on the values 1 though 10, so "from x=1 to 10 do" isnt correct, because nothing starts "from" x. Even though something does in fact start at "1", x only takes on that value one time, not as a constant. The phrase "for x=1 to 10" declares that something called x will take on a range of values, not just one alone, and we arent starting 'from' or 'at' a RANGE of values, just ONE single value. the part of the phrase "from x=1 to 10" "from x" implies that there exists something "at x" from which to start, which there really doesnt. and nothing starts 'at x', it starts 'at 1' or, 'from 1'. In particular, x starts at 1, not at x. x doesnt start from x, it starts from 1. Rewording that part of it, "from x" (=1 to 10 do) would look like this: "starting at x" (=1 to 10 do) and the whole thing would look like this: "starting at x=1 to 10 do" which is totally incorrect because nothing is starting at x, x is starting at 1. Any doubts? BTW, do you play chess as good as Kasparov? Take care for now, Al
2. RE: Why 'for', not 'from' ?
- Posted by Henri Goffin <H.Goffin at skynet.be> Jun 02, 2003
- 391 views
Hi Igor. If you really want to stick to the keyword (from) in a do-loop I would suggest the following syntax extension to Eu: sequence S for obj from S do ... <some statements involving obj> ... end for which would be semantically equivalent to: for i = 1 to length(S) do ... <some statements involving S[i]> ... end for and would read "for obj taking all its values from S do the following". This would give a shorthand notation that might improve the readibility. IMHO that control structure would not betray the spirit of Euphoria. But there is of course one BIG caveat: would a modification of the sequence of values be allowed inside the loop? Preferably not, but then, is it easy for the interpreter to check for such a situation? Henri Goffin -----Original Message----- From: Igor Kachan [SMTP:kinz at peterlink.ru] Sent: Monday, June 02, 2003 10:17 PM To: EUforum Subject: Re: Why 'for', not 'from' ? << File: ATT00082.txt; charset = KOI8-R >>
3. RE: Why 'for', not 'from' ?
- Posted by Al Getz <Xaxo at aol.com> Jun 03, 2003
- 410 views
Hello again Igor, --compare: for our container that is going to hold 1 to 10 different objects --sounds ok from our container that is going to hold 1 to 10 different objects --sounds like we are going to take something out of it. from OurVeryLargeSetOfDistinctlyDifferentProcedureNames=1 to 10 do --sounds like we are getting ready to take something from them. for OurVeryLargeSetOfDistinctlyDifferentProcedureNames=1 to 10 --sounds like we are getting ready to do something, which we are. Then again, the 'for' loop takes up two less bytes per loop instance; what do you have to say about that? Take care for now, Al
4. RE: Why 'for', not 'from' ?
- Posted by Al Getz <Xaxo at aol.com> Jun 03, 2003
- 372 views
Hi again, Igor Kachan wrote: > > > Hello Al: > > > --compare: > > > > for our container that is going to hold 1 to 10 different objects > > --sounds ok > > > > from our container that is going to hold 1 to 10 different objects > > --sounds like we are going to take something out of it. > > Why out? > Because 'from' makes the sentence less clear then 'for'. Granted, there are some cases where from and for can be used interchangeably Find the integral of y with respect to x for x=1 to 20 Take the integral of y with respect to x from x=1 to 20 However if you arent specifing a range, find the integral of y with respect to x at x=2 find the integral of y with respect to x for x=2 now lets try 'from' find the integral of y with respect to x from x=2 >From doesnt work here. In other words, it sounds like you are trying to replace the word 'from' with the word 'after'. In any case, if you replace all your file's 'for' keywords with the keyword 'from' you will have to also modify any prewritten libraries you choose to use, unless you write them all yourself or make a translator. You would run into hits on both 'for' and 'from': --prewritten: global function from(integer a) for x=a to 100 do Something() end for return 1 end function BTW, I'm having pretty good luck with 'for' these days because 'for' is used in every programming language i currently use Take care for now, Al PS. I've also seen "Let x=1 to 10" which makes the most sense. I guess if you really wanted to, you could leave off the leading word completely: x=1 to 10 { Write("Hi there") } This was my preference years ago when storage space was a scarce commodity.
5. RE: Why 'for', not 'from' ?
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Jun 03, 2003
- 377 views
> From: Igor Kachan [mailto:kinz at peterlink.ru] > 1,2,3,4,5 is it "From 1 to 5"? Yes it is. Isn't it? > "ot 1 do 5" in Russian > > x=1,2,3,4,5 is it "From x=1 to x=5"? Yes it is. Isn't it? > "ot x=1 do x=5" in Russian > > Where is that "FOR" for ("dlya" in Russian) the loop's parameter? > > How can I say "From 1 to 5" another way in English? As someone pointed out, the use of 'for' likely comes from mathematical jargon: for x = 1 to 10 do could be translated as: let X = {1,2,3,4,5,6,7,8,9,10} for each x in X [sequential] do Matt Lewis
6. RE: Why 'for', not 'from' ?
- Posted by Bernie Ryan <xotron at bluefrognet.net> Jun 03, 2003
- 383 views
Igor: >> How can I say "From 1 to 5" another way in English? USING 1 TO 5 Bernie
7. RE: Why 'for', not 'from' ?
- Posted by Al Getz <Xaxo at aol.com> Jun 03, 2003
- 389 views
Igor Kachan wrote: > > > Thanks Derek, Thanks Matt, Thanks Al: > > [snipped many very useful info for me, thanks] > > > > How can I say "From 1 to 5" another way in English? > > > > Try "Starting with 1 through to 5". > > Ok, this phrase is just about a variable, > but seems to be too long. > > But where is that famous FOR? > > Yes, English is good, but I really prefer > Russian for this subject: > > "ot 1 do 5" ili "ot x=2 do 100 po 2" - Russian > "from 1 to 5" or "from x=2 to 100 by 2" - English > "for x=2 to 100 by 2" - EU & Company > > English is not so good for the loops > programming, just on my taste, sorry. > EU for-loop is clear for me now > > Thanks again! > > Best Regards, > Igor Kachan, > kinz at peterlink.ru > > Hi again Igor, I had to say one last thing on this subject... Most of us are so used to seeing 'for' we forgot it's also an english preposition. I've been seeing 'for' so long it doesnt look like a prep to me, it looks like a verb like 'let' in a declarative statement: "let x equal one to ten". Perhaps in this case the jargon dictates the rule, not the other way around. There are too many cases in technical lit to say normal English always rules. I think instead normal English tries to keep up. Take care for now, Al