[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: NR (no ruler)



Reply to note from Harry Binswanger  Fri, 01 Feb
2008 12:32:02 -0800

Harry:

> I guess I've been using PV for so many years only to *display*
> a s/g's value that I forgot it can also execute it.

That "also" sets up a false dichotomy. PV -- which stands, of
course, for Put Value -- takes the S/G's contents, evaluates it
(determines the "S/G's value", as you say) and puts out the result.
In other words, PV does to the contents of a Save/Get what RUN does
to the contents of a file. If you RUN a file consisting of text,
the text is put, one character at a time, at the cursor location
(CMline or text). Yes, the characters are "displayed", because that
is how the XPL interpreter operates on text, but equally they are
interpreted, or RUN. (If you've ever wondered whether there exists
an XPL quine -- a program that "evaluates to itself", or prints out
its own source code -- the answer is yes, infinitely many, although
they're all trivial. Any text that does not include any XPL
expressions or 3-byte functions is a quine.) When the S/G contains
an expression or instruction (e.g., a 3-byte function) capable of
evaluation, PV'ing (or RUNning) it becomes more consequential:
expressions are evaluated (Editor does the math), instructions are
carried out. Interesting things happen.

> What I do for multiple exit points is define a LaBel 
> with all the cleaning up needed and an . Then I make all
> the exit points go to it (GLzz).

Sound practice. Just make sure that the EXit LaBel is at the
earliest possible location in the program, so that all of the GL
commands point backwards, not forward. Backward-looking GL commands
execute faster than forward-looking GLs -- another of Robert's
useful discoveries.

> I'm wondering what the difference is between:
> >+Q2 > and
> >Q2 >
> AHA--you can't use 01 twice in the latter, and
> that's why you say it saves a S/G assignment. Now
> why can't you have SU01 refer to S/G 01?

Because  *overwrites* any existing contents of 01!
Q2 > evaluates to a meaningless feedback loop.

> BTW, I couldn't get your version of the SUbroutine to work. Is
> there a typo or something in this:

Whoops, my bad. Contrary to what I said yesterday, you CANNOT
manufacture a SUbroutine by concatenation, as in
+"Q2 ">. If the concatenation is to be
*evaluated*, it must be manufactured with SX, and executed with PV.
Once you make that simple change to your code, it works fine. RUN
this:

XPLeNCODE v2.0
b-gin [UNTITLED]
[BX_]d nw=3[Q2_];*;[cr|lf]{<}SX01,{<}VA$NW{>}{>};*;[cr|lf][BX
_]d nw=1[Q2_];*;[cr|lf]{<}SX03,{<}VA$NW{>}{>};*;[cr|lf]{<}SX1
1,"The old is "+{<}IS01{>}+" and the new is "+{<}IS03{>}{>};*
;[cr|lf]{<}PR@11{>};*;[cr|lf][BX_]p 3[Q2_];*;[cr|lf]{<}SX15,"
[BX_]d nw="+{<}IS01{>}+"[Q2_]"{>};*;[cr|lf]{<}PV15{>};*;[cr|l
f]{<}SX03,{<}VA$NW{>}{>};*;[cr|lf]{<}SX11,"now should be back
 to "+{<}IS01{>}+"--it's "+{<}IS03{>}{>};*;[cr|lf]{<}PR@11{>
}{<}EX{>};*;[cr|lf]
-nd
XPLeNCODE

> This is all fascinating.

I happen to agree. But I repeat: if mastery is your goal, read and
reread CTRLCHAR.TXT, especially (but not only) the sections entitled
Differences Between GT and PV, Concatenation, and The PV
Interpreter, and study the examples. The date of that treatise,
BTW, is February 1990 -- eighteen years to the day.

--
Carl Distefano
cld@xxxxxxxx