Re: [stack] a concatenative language for the Semantic Web

Manfred Von Thun <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <C27B81C6.9B6%[email protected]>


On 22/5/07 12:38 PM, "Joshua Shinavier" <[email protected]> wrote:
> 
> [..]
> The Java implementation of Ripple is best suited to applications
> involving multivalued relations, such as RDF's.  It uses some rather
> expensive compositional plumbing to distribute each operation over
> arbitrarily many values, so if you don't need that functionality,
> you're better off using Joy, Factor, etc.

It is the word ³multivalued²  that prompts me to respond. Relations instead
of functions. Just about all of the discussion here has implicitly equated:
concatenative = functional = stackbased. That need not be so. Consider
the classical declarative languages: (the purely functional subset of) Lisp
and (the purely ³logical² subset of) Prolog. Take Lisp, remove abstraction,
remove application, replace by concatenation: you get one or the other
concatenative language which uses a stack. Now take Prolog: remove
the (³logical²) variables, remove application, use a stack. (I did not
at this point say: use only concatenation). Programs now compute
binary relations between stacks. Relations can be composed (and since
unary functions are binary relations, unary (stack) functions can be
composed. We could use program concatenation to denote the relation
which is the composition of the relations denoted by the programs
that are being concatenated. Hence a relational stack language.

Many of the primitives of such a language would be indistinguishable
from those in a functional stack language. But there may well be
useful primitives that are relational. One example: the two square
roots (positive and negative) of a positive number. Another: the
data relations in the RDF that you speak about.

More likely than not one would want to construct multivalued relations
from others, including ones that are single-valued. One needs some
kinds of operators that can do this. In Henderson¹s wonderful Lispkit
book, Functional Programming, Interpretation and Implementation,
there is a chapter in which discusses how to turn a functional language
into a relational language. Two novel operators are needed: some
kind of OR that splits execution into two paths, and a NONE operator
which (supposedly) is never executed. (OR and NONE correspond to
what in Prolog are disjunction (³;²) and fail.) One might do the same
to a functional stack language: add OR and NONE to get a relational
stack language.

As far as the syntax is concerned, NONE is unproblematic: it has to
be a nullary operator. But for OR there are two possibilities:

(1) Write OR as an infix operator, perhaps as ³|², the vertical bar
familiar from regular expressions, or just as ³OR².

(2) Write OR as a combinator which takes two quotations off the stack
and let it initiate two executions.

I am still unclear on the advantages and disadvantages of these two
possible notations. Of course there may be others again.

As an unintentional ³side effect² of my current experiments with Joy
in Prolog, I stumbled upon (2), and it was trivial to implement. But
I still have not thought of any remotely useful programs to benefit
from this relational extension.

Maybe these thoughts are of some value for your Ripple. Best
wishes for the implementation, Joshua.

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