Manfred Von Thun | 14 May 2008 07:49
Picon
Picon
Favicon

Re: [stack] QuoteAndEval



On 14/5/08 6:19 AM, "William Tanksley, Jr" <wtanksleyjr <at> gmail.com> wrote:
>
> Manfred Von Thun <m.vonthun <at> latrobe.edu.au <mailto:m.vonthun%40latrobe.edu.au>
> > wrote:
>
>> > Is there a lesson to be learned for concatenative languages?
>
> I don't know what the lesson would be. Backquotes escape from a string
> context to an executation/evaluation context. I suppose one could do
> that in a concatenative language that had a string syntax.
>
Maybe I should not have chosen those examples with the chatty strings inside
which
the backquote occurred. Here is an example that illustrates the Eval =
Unquote
principle: Eval(Quote(x)) = x:

echo `date` = date

For a concatenative language the lesson would be a facility to reach out
into the numerous Unix utilities which compute unary functions from
streams of bytes to streams of bytes. It would start with a string in the
concatenative language and end up with another string. All the Unix piping
would be done at the level of the concatenative language. The example
of counting the files in the home directory would look like one or the
other of these:

³la ~² ls ³-l² wc
³ls ­la ~² unix ³wc ­l² unix

This should leave a string of digits on top of the stack (or perhaps better,
an integer).

> More generally, I suppose one could "escape" from any context to an
> evaluation, thus allowing you to compute a value at runtime which will
> be compiled into the current quotation.
>
I definitely meant escaping to unix. Escaping to evaluate a quotation
is already in Joy: suppose there is a quotation on top of the stack. Then

stack swap infra first

or something similar will push the result of executing the quotation
onto the stack. Whether that result is to be spliced into another
quotation (what you called the current) is another matter again.

- Manfred

[Non-text portions of this message have been removed]

__._,_.___
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Curves on Yahoo!

Share & discuss

Curves, fitness

and weight loss.

Yahoo! Groups

w/ John McEnroe

Join the All-Bran

Day 10 Club.

.

__,_._,___
Raymundo Quirino Baquirin | 16 May 2008 22:40
Picon
Favicon

[stack] Re: QuoteAndEval

Hi, Manfred,

This discussion triggered a memory which caused me to consult a REXX
manual. In REXX ordinary strings enclosed in matching single or
double quotes are considered commands to be sent to the operating
environment. In fact, any expression which upon evaluation was not
recognized as a language instruction is considered a command--quoting
the expression if in fact it was an OS command tells REXX not to
bother evaluating it, just ship it off to the OS and get a return code
back. In fact, the operating environment could be set to a custom
program, not necessarily the OS shell.

IMHO something like this would be great for an embedded Joy, such as
JoyJ. Of course something like the Unix backquote syntax would be
required.

Servus,

Ray

--- In concatenative <at> yahoogroups.com, Manfred Von Thun <m.vonthun <at> ...>
wrote:
>
>
>
>
> On 14/5/08 6:19 AM, "William Tanksley, Jr" <wtanksleyjr <at> ...> wrote:
> >
> > Manfred Von Thun <m.vonthun <at> ... <mailto:m.vonthun%40latrobe.edu.au>
> > > wrote:
> >
> >> > Is there a lesson to be learned for concatenative languages?
> >
> > I don't know what the lesson would be. Backquotes escape from a string
> > context to an executation/evaluation context. I suppose one could do
> > that in a concatenative language that had a string syntax.
> >
> Maybe I should not have chosen those examples with the chatty
strings inside
> which
> the backquote occurred. Here is an example that illustrates the Eval =
> Unquote
> principle: Eval(Quote(x)) = x:
>
> echo `date` = date
>
> For a concatenative language the lesson would be a facility to reach out
> into the numerous Unix utilities which compute unary functions from
> streams of bytes to streams of bytes. It would start with a string
in the
> concatenative language and end up with another string. All the Unix
piping
> would be done at the level of the concatenative language. The example
> of counting the files in the home directory would look like one or the
> other of these:
>
> ³la ~² ls ³-l² wc
> ³ls ­la ~² unix ³wc ­l² unix
>
> This should leave a string of digits on top of the stack (or perhaps
better,
> an integer).
>
> > More generally, I suppose one could "escape" from any context to an
> > evaluation, thus allowing you to compute a value at runtime which will
> > be compiled into the current quotation.
> >
> I definitely meant escaping to unix. Escaping to evaluate a quotation
> is already in Joy: suppose there is a quotation on top of the stack.
Then
>
> stack swap infra first
>
> or something similar will push the result of executing the quotation
> onto the stack. Whether that result is to be spliced into another
> quotation (what you called the current) is another matter again.
>
> - Manfred
>
>
>
> [Non-text portions of this message have been removed]
>

__._,_.___
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Yahoo! Groups

w/ John McEnroe

Join the All-Bran

Day 10 Club.

Find Balance

on Yahoo! Groups

manage nutrition,

activity & well-being.

.

__,_._,___

Gmane