Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!agate!saturn!darkstar!ucscc!gorn!filbo From: filbo@gorn.santa-cruz.ca.us (Bela Lubkin) Newsgroups: comp.lang.pascal Subject: Re: file windows (was Re: Standard Pascal) Summary: red in the face Message-ID: <2.filbo@gorn.santa-cruz.ca.us> Date: 30 Jul 89 21:53:20 GMT References: <1.filbo@gorn.santa-cruz.ca.us> Organization: R Pentomino Lines: 34 In article schwartz@shire.cs.psu.edu (Scott Schwartz) writes: > >In article <1.filbo@gorn.santa-cruz.ca.us> Bela Lubkin writes: >+----- >| A >simpler< and >more< elegant >| piece of Standard Pascal code that does the same thing is: >| >| while not eof do begin >| read(number); >| if (number >= '0') and (number <= '9') then process(number); >| { else don't do anything, thus disposing of the invalid char } >| end >+----- > >In the previous posting, Number was of type REAL (or INTEGER), not >CHAR. Why write code to "process" it when the language will do it for >you? That's what file windows buy you. Your example is incomplete, >then, whereas the other posting contained complete code to do the >operation, in approxomately the same number of lines. A telling point >in favor of using language features to their fullest. My mistake; as I said, my Standard Pascal's a bit rusty. I didn't catch the implications of Input^ (type Char) vs. Number (type Real). I had the impression that the inputs were being put together by the procedure Process. I disagree about "approximately the same number of lines": my version is definitely shorter and would generate smaller, faster code; >IF<, that is, it was solving the same problem. >-- >Scott Schwartz Bela Lubkin * * filbo@gorn.santa-cruz.ca.us CIS: 73047,1112 @ * * ...ucbvax!ucscc!gorn!filbo ^^^the slowest route R Pentomino * Filbo @ Pyrzqxgl (408) 476-4633 & XBBS (408) 476-4945