[stack] QuoteAndEval

Manfred Von Thun <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <C44F6806.112A%[email protected]>
Still on the topic of quote and eval, it occurred to me that the Unix
command
languages (sh, csh, ksh, bash,..) have their own eval operator. It is the
backquote mechanism, which will evaluate what is enclosed inside the
backquotes `...` (I don¹t know what my mailer will do to it, it is the key
just under escape key at the top left). Example:

echo ³Today¹s date and the current time is `date`, have a nice day!²

Here the echo means print the following message which contains a short
backquoted command. The command returns a string that will be spliced
into the message. More complex commands can be backquoted:

echo ³In your home directory you have `ls ­la ~ | wc ­l ` files²

Here the ls command produces an output which is piped (with |)
to the wordcount facility wc to count just the lines.

The beauty of the various Unix utilities is that you can pipe the output
of one to become the input to the next. The backquote substitution
can make good use of it.

Is there a lesson to be learned for concatenative languages?
We have discussed Unix pipes briefly before, and their semantics
is clear: a pipe  X | Y | Z computes the composition of the functions
X, Y and Z, just as any other concatenative language. But the
backquote is something else deserving a thorough examination.

  - 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.