Re: [stack] QuoteAndEval

Manfred Von Thun <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <C450BAA4.1135%[email protected]>


On 14/5/08 6:19 AM, "William Tanksley, Jr" <[email protected]> wrote:
> 
> Manfred Von Thun <[email protected] <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]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.