
Learn Prolog now - iuguy
http://www.learnprolognow.org/
======
silentbicycle
Sterling & Shapiro's _The Art of Prolog_ is fantastic, if _Learn Prolog Now_
piques your interest. Clocksin's _Clause and Effect_ is sort of like "The
Little Schemer" for Prolog (though not cutesy).

Also, if you learn Prolog, don't forget to learn the constraint programming
extensions! SWI and GNU Prolog are free Prologs with constraint programming
included. It makes Prolog _much_ more practical.

~~~
metageek
Thanks; I just bought _The Art of Prolog_ used at Amazon ($13 with shipping).

~~~
silentbicycle
You probably got the first (1986) edition. The second (1994) edition is _much_
better, but more expensive. (But, there's a $49 copy on amazon. That's a
steal! I paid $80ish, argh...)

They added quite a bit of material to the latter chapters, and it updated to
the newer, then de-facto standard Prolog (which became an ISO standard in
1995). Useful Prolog implementations usually have non-ISO extensions for
module systems, constraint programming, etc.

I have both. I keep the first edition at the office, and it's my lending copy.

~~~
metageek
Uh...yes, you're right, this is the 1986 edition.

Oh, well. Saving $30 on a language I'm not likely to use is probably a Good
Thing.

~~~
silentbicycle
No worries. I got the 1986 edition for $5 and liked it so much I got the newer
for $80. Learning Prolog changed the way I think as much as learning Lisp or
C.

------
aphyr
Has anyone created a probabilistic language akin to Prolog? I feel like
confidence interval propagation, with appropriate notions of covariance and
error distributions, could be really useful for hypothesis testing.

~~~
nathanmarz
There's PRISM, which is used for analyzing probabilistic systems:
<http://www.prismmodelchecker.org/>

~~~
aphyr
Oh my god. I have dreamed of, and half-implemented badly, exactly this. Not
quite what I was thinking of, but still quite useful for that class of
problem.

You should submit this as an HN post too. Thanks!

------
iuguy
I've always felt Prolog was a massively underrated language. I've been going
on a bit of a retro fest looking through languages I dabbled with as a child.
I think the only thing I liked more as a child than MicroProlog was possibly
Forth.

~~~
jdp23
Agreed -- back in the day Prolog and Forth both exposed me to very different
ways about thinking.

I actually wrote my Masters' project on transistor sizing in Prolog. A
fascinating experience, although at the time it was horrible for numeric work.
I wound up hacking the interpreter to include a couple of optimizations
otherwise I'd probably still be waiting for it to finish :-)

~~~
iuguy
Oh wow. I wish I could've done my projects in Prolog. I failed a unit at
college on sorting algorithms because I submitted my work in Prolog instead of
Qbasic. My lecturer didn't know Prolog and I was too young and stupid not to
get into an argument over it. Just as well as I was used to 8-bit Micro-Prolog
(this in fact: <http://www.worldofspectrum.org/infoseekid.cgi?id=0008429> \-
you can use it in a browser if you're feeling masochistic!) and had no idea
about the differences between LPA and other implementations!

------
sdizdar
Actually, one of the best book for Prolog is book written by my professor Ivan
Bratko: [http://www.amazon.com/Prolog-Programming-Artificial-
Intellig...](http://www.amazon.com/Prolog-Programming-Artificial-Intelligence-
Bratko/dp/0201403757)

We had to write Pascal interpreter in Prolog - that was an experience. I
strongly suggest to everybody to try Prolog - then you will understand why it
is good idea to use declarative languages as much as possible when building
product (including SQL).

------
iuguy
Incidentally, for those that are interested you can try the examples in a
browser at the article linked from the HN post here:
<http://news.ycombinator.com/item?id=1976397>

------
Jach
If you've got time to spare, check out this video series on Youtube:
<http://www.youtube.com/watch?v=33S6qap_SIU> It's about learning Kolmogorov
Complexity with Prolog.

------
iwr
The DCG functionality of Prolog is very nice. I used it to write a crude XML
parser just days into learning about the language.

<http://pastebin.com/sUpPd5jb>

------
iwr
Is there a framework where you can use Prolog as a web development language?
Server and/or client-side.

------
nubela
Perhaps it is just me, but does anyone else think Prolog is really just a
nicely done language that revolves around the an if-then-else condition? Its
basically pattern matching... But consider me troll and argue your stand.

~~~
silentbicycle
No, it's unification and backtracking.

Unification is far more powerful than pattern matching, which (among other
things) supports working with partial information - you can pass around a list
of cons cells where the cdr is an unbound variable, and then bind it to
another cons cell with an unbound cdr to get O(1) appending, for example.
(These are called difference lists.) Same can be done with trees and other,
more complex data structures. In effect, rather than fully immutable or fully
mutable variables, you get variables that can only be set _once_ , and then
semantically "always were" that value. (but possibly undone on backtracking)

Backtracking means that pattern-matching a variable isn't just pass/fail, but
potentially a _generator_ (AKA "iterator", etc.) for all matching values.
Sometimes (ok, often) the ensuing combinatorial explosion keeps it from
scaling efficiently to real problems, but constraint programming compensates,
pruning off a LOT of the space of potential solutions before searching. And,
saying, "here's my problem, throw everything at it and figure it out" in very
few lines of code is still great for prototyping.

Comparing Prolog to Erlang makes the difference clearest, to me. Erlang
doesn't do backtracking (because it throws soft-real-time guarantees out the
window!) or full unification (because passing around and subsequently binding
unbound variables would be a form of non-local state). Erlang is still a great
language IMHO, but it's a very different kind of language, because those two
features are what make Prolog Prolog.

------
scarboy
I've been meaning to learn Prolog since I took an AI course that focused on
theorem proving.

I can't help but notice that the webpage looks like one of the awful default
Beamer presentation styles.

------
rikthevik
Yes.

