HP3000-L Archives

June 2000, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Ted Ashton <[log in to unmask]>
Reply To:
Ted Ashton <[log in to unmask]>
Date:
Wed, 7 Jun 2000 17:46:06 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (51 lines)
Thus it was written in the epistle of [log in to unmask],
> Ted writes:
>
> > Of course, a Perl programmer would probably eliminate all whitespace at the
> >  end, and would likely have the string in $_ already and so would do:
> >
> >  ($last_four) = (/(.{0,3}\S)\s*$/);
>
> Lordy, there are several easy ways to tell an "ugly" language. The code above
> is one of them :-)

You ain't seen nothing yet . . . :-)

> In most BASICs, exactly the same functionality would be written out in plain
> English as (and capable of allowing former secretaries to become excellent
> programmers):

Is that all it takes?

>     lastfour = right(rtrim(mystring))

Nice duck, Wirt.  Now write it in HP BASIC:

10 L$=DEB$(M$)
20 IF LEN(L$)>4 THEN L$=L$[LEN(L$)-3;4]

And you were saying about "ugly" languages . . .

> which is very much like the CI interpreter on the HP3000. Code that is easy
> to read is no less efficient that code that's a mess.

Quite true (once we get past the discussion of what "mess" means), but it's
worth noting that in text processing, the BASIC code above has pretty much come
to the limit of its abilities and the Perl code has hardly gotten started :-).

> But, as I said before, in QueryCalc, the code would merely be:
>
>     rjs$(ab4,4)

And would you care to give the equivalent code which *includes* the trailing
spaces (see previous Python and Perl samples)?

Ted
--
Ted Ashton ([log in to unmask]), Info Sys, Southern Adventist University
          ==========================================================
Mathematics is a language.
                                        -- Gibbs, Josiah Willard (1839 - 1903)
          ==========================================================
         Deep thoughts to be found at http://www.southern.edu/~ashted

ATOM RSS1 RSS2