[Haskell-cafe] Learn Prolog...

Andrew Coppin andrewcoppin at btinternet.com
Sun Sep 2 07:23:32 EDT 2007


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



More information about the Haskell-Cafe mailing list