[Tutor] Problems with genetically engineering the Print Ogre

dman dsh8290@rit.edu
Wed, 27 Feb 2002 20:17:23 -0500


On Wed, Feb 27, 2002 at 11:25:32PM +0100, Scot Stevenson wrote:
| Hello Remco, 
| 
| > Personally I think list comprehensions are beautiful. It helps if you
| > are used to similar notation in math.
| 
| I sure it does - but that does somewhat confirm my suspicion that this is 
| a construct added for a very specialized group of users =8). 

"Math" doesn't really denote a very specialized group of users.  Much
of programming involves math.  Either basic arithmatic and algebra
suffice for your programming needs, or you delve in to discrete math.
Some parts of discrete math deal a lot with sets, sequences, and
operations and relations pertaining to them.  All Software Engineering
majors at my school are required to take Discrete Math I and II.

Once you get used to operating on lists of things, it is very natural
and concise.  If you don't like the syntax, use map and filter for a
while, then try them again.

| > So after the "print", the parser sees "to" as the next word. It has to
| > decide whether that is a variable (actually, the start of an expression)
| > or part of the print statement, and it can't.
| 
| Ah, that explains it - thank you!
| 
| Since I came into the discussion late - did anybody ever suggest using a 
| format like 
| 
|     to <file> print <stuff>
| 
| or, as not to use up "to" as a word, 
| 
|     into <file> print <stuff>
| 
| instead? Shouldn't this let the parser elves figure things out quite 
| nicely, since "into" would have to be followed by a file-like thingy every 
| time,

Nope.  The _parser_ has no idea what type of thing an identifier
refers too.  The parser only knows whether it found a keyword,
operator, or identifier.

-D

-- 

The teaching of the wise is a fountain of life,
turning a man from the snares of death.
        Proverbs 13:14