[Haskell-cafe] Learn Prolog...
semanticphilosopher at googlemail.com
Sun Sep 2 08:26:43 EDT 2007
Cut is a means of preventing backtracking beyond that point - it
prunes the potential search space saying the answer must be built on
the current set of bindings. (Lots of work went into how automatically
get "cut's" into programs to make them efficient but without the
programmer having to worry about them).
Atoms: think unique symbols that are elements in the set which is the
program's universe of discourse - one that is closed (no infinities
there please). All its doing is unifying things to see if they fit the
rules. It is one large parser that gives you back the bindings it made
on the way.
I do remember the day when a prologue researcher was fiercely
defending that prologue could compute solutions to problems that were
not achievable with "ordinary turing complete languages" - nothing as
ugly as a rampaging mob of Computer Scientists!
I've even written (late 80's) a program in prologue that performed
real-time subtitling for the deaf, which I'm told is still being used
Would I use it now? - never - it may give you an answer but rarely
does using it give you understanding and you can always code up the
searching algorithms if you have to go that brute force. And in the
end it is the understanding that is reusable, not the answer.
On 02/09/07, Andrew Coppin <andrewcoppin at btinternet.com> wrote:
> > One of standard exercices in Prolog is the construction of the
> > meta-interpreter of Prolog in Prolog. While this is cheating, I recommend
> > it to you. It opens eyes.
> Ever tried implementing Haskell in Haskell? ;-)
> > Prolog strategies are straightforward, and I simply cannot understand the
> > comments of Andrew Coppin. Which arbitrary set of conclusions?? Which
> > patently obvious results not derivable?? Be kind, give some examples,
> > otherwise people may suspect that you are issuing vacuous statements...
> Read my whole message. What I was saying (in essence) is that Prolog
> seemed to be performing "impossible" feats of logical deduction - until
> I saw a unification algorithm implemented in Haskell, and then it all
> made sense.
> (They showed an example where you basically program in a list of who is
> related to who, and then the computer suddenly seems to be able to
> magically deduce arbitrary family relationships - without any code for
> doing this being defined. This seemed utterly far-out to me... I'm not
> used to computers begin able to "think" for themselves. I'm more used to
> having them blindly follow whatever broken sequence of commands you feed
> to them... And yet, given a set of facts, this Prolog interpreter seemed
> to be able to magically derive arbitrarily complex conclusions from
> them. Double-impossible! Until I learned how it's implemented...)
> Having said all that, I still don't "get" what the purpose of the "cut"
> operator is. I also failed to understand the Prolog syntax description.
> (What the heck is an "atom" when it's at home? I thought an atom is a
> unit composed of protons and electrons...)
> I can certainly see why Prolog would be very useful for certain types of
> problems. As it happens, not the kind of problems that usually interest
> me. ;-)
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe