Re: [stack] QuoteAndEval
2008-05-14 05:49:56 GMT
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]
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch format to Traditional
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___
RSS Feed