Re: defining operators with a result
- From: nallen05@xxxxxxxxx
- Date: 13 Nov 2006 20:50:57 -0800
Richard Szopa wrote:
First of all, thank you all for your answers.
I think that the solution proposed by Glenn Lieding doesn't really
solve my problem. Having to adapt every predicate to deal with the mton
structure won't make my code more compact or more readable. Also, I
would like to be able to use my notation in built-in predicates, like
for example reverse and so on.
On the other hand, GRIPS goes much too far for me--I realize that
Prolog uses relational notation and I'm quite happy with it. Also, I
find remaining understandable for the rest of Prolog programmers quite
important. ;-)
The idea of trying to add this sugar to Prolog came to me when I found
that I use [m..n] quite often in my pseudo-Prolog code, but when I
translate it into Prolog, it gets somehow more obscure.
Anyway, an additional question: how would one define in Prolog |, the
cons operator, if it wasn't built in the language and f one wanted it
work exactly as | works now in [Head|Tail]? Or, if one wanted to be
able to use the '@' sign in one's Prolog programs instead of '|'? Is
it possible?
Of course, hacking the source of the interpreter is not the kind of
answer I expect ;-)
I'm not sure this is the answer you're looking for either, but:
extending the syntax of a lisp-embedded prolog is trivial if you stick
with sexps, and Common Lisp has an extendible reader for your to define
your own own special syntax...
ACL has a good embedded Prolog
http://www.franz.com/support/documentation/8.0/doc/prolog.html
but the source of the Prolog from Peter Norvig's book PAIP is available
under a nice license
http://www.norvig.com/license.html
also Paul Graham's book On Lisp is free to download and describes a
lisp-embedded prolog
http://www.paulgraham.com/onlisptext.html
hth
Nick
-- Richard
.
- Follow-Ups:
- Re: defining operators with a result
- From: Markus Triska
- Re: defining operators with a result
- References:
- defining operators with a result
- From: Richard Szopa
- Re: defining operators with a result
- From: Nameless
- Re: defining operators with a result
- From: Richard Szopa
- Re: defining operators with a result
- From: Jan Wielemaker
- Re: defining operators with a result
- From: Richard Szopa
- defining operators with a result
- Prev by Date: Re: defining operators with a result
- Next by Date: Re: defining operators with a result
- Previous by thread: Re: defining operators with a result
- Next by thread: Re: defining operators with a result
- Index(es):
Relevant Pages
|
|