Robert Virding schrieb:
>> Any Prolog system around for a notation
>> >of xfy Lists. First a little motivation
>> >for such lists. In Logic, often the head
>> >is put on the right hand side, instead of
>> >the left hand side of a list.
> The really interesting question is why you want this?
To make the notation more iconic to what is
used in math. Its not a hard business case,
its more a soft business case of human computer
interaction.
But I see drawbacks besides the advantage at the
same time:
1) Advantage: Lets say I would have tupple
syntax in Prolog which uses yfx Lists,
with empty list as '<>' and yfx cons as
''''. Then for example I would have
<<x1,..,xn>|xn+1> = <x1,..,xn,xn+1>
Could be more comfy for some applications
than the ordinary Prolog lists. The
initial example I gave was from Logic,
where sequents can be seen as having
yfx cons.
2) Disadvantage I: One more grammar Rule
in the Prolog syntax. Violates KISS
Principle. More code to write for the
parser. More documentation needed.
3) Disadvantage II: Some predicates that
do some generatic stuff on lists, wouldn't
be able to do that on tupples.
Unless tupples only exist on the surface, and
wouldn't use '<>'/0 and ''''/2, but instead
'[]'/0 and '.'/2. But then unparsing
wouldn't reconstruct the tupple.
Or otherwise Prolog would know object orientation,
so that one could write single rules that work
both for lists and tupples and who knows what.
Many object oriented languages can do that.
Besides generic rules that would work for
all list like structures, one could also
specify specific rules. For example to keep
some structures sorted and others not.
Currently the bulk of Prolog libraries is
not object oriented. Just xxxpredictaes, for
example a module lists and a module ordsets,
but they don't have anything in common.
Bye