Re: Lost in translation
- From: Damien Kick <dkixk@xxxxxxxxxxxxx>
- Date: Wed, 23 May 2007 09:29:46 GMT
Markus Triska wrote:
Damien Kick <dkixk@xxxxxxxxxxxxx> writes:
this "a / b / c" syntax.
That's infix syntax for the term /(/(a,b), c) (functor: /, arity: 2):
%?- a/b/c == /(/(a,b), c).
%@ Yes
Ah, I think that what I was forgetting is that '/' only acts as the operator for division in the context of 'is', i.e. "X is a/b". Outside of that context, it is a functor like any other. He could've used "a+b+c" just as well (or just as confusingly) as "a/b/c".
That's a bad choice to represent a tuple. It's clearer and cheaper to
use a term like flight(a,b,c).
Well, I was personally expecting to see something like flight(a,b,c) instead. Bratko seems to use this <http://tinyurl.com/2m335v> quite a bit, though. The trip planner <http://tinyurl.com/ysqygq> and an eight queens solver <http://tinyurl.com/2fded9> being just two examples. Is this not typical prolog style, then? Either way, it seems like my prolog-in-lisp translation indeed did not lose any semantics in the translation.
In your Prolog example, infix notation is used in yet another place:
%?- a:b == :(a, b).
%@ Yes
This didn't confuse me, I think, because ':' doesn't already have a predefined meaning in prolog.
.
- References:
- Lost in translation
- From: Damien Kick
- Re: Lost in translation
- From: Markus Triska
- Lost in translation
- Prev by Date: Re: My First Lisp...
- Next by Date: Re: Can you learn computer science from a school?
- Previous by thread: Re: Lost in translation
- Next by thread: type secure error handling
- Index(es):
Relevant Pages
|