All the Perl that's Practical to Extract and Report

Navigation

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Without JavaScript enabled, you might want to
use the classic discussion system instead. If you login, you can remember this preference.

I didn't write the tests firsts because I was porting this from W-Prolog and frankly, since I wasn't entirely certain what W-Prolog was doing half the time, I wasn't certain what I was writing tests for. However, by doing a faithful port from a known-good program, I could run them in parallel and keep the Perl one working properly. Now that it appears that I've nailed down the behavior of the Perl version, I'm writing tests. Curiously, in the process I've found a discrepancy between the Java and Perl ver

Actually, I doubt it's above your level of comprehension. Logic programming isn't that hard, it's just a weird way of looking at things. For example, remember syllogisms in logic class?

All cats are mammals.All mammals have fur.Therefore, all cats have fur.

In prolog:

mammal(cat).

furry(X):- mammal(X), not(shaved(X)).

The:- is read as "if" and the comma is read as "and". I'm sure you can figure out what that means:)

In logic programming, you don't tell the computer how to figure things out (like you would in normal imperative programming.) Instead, you present the computer with facts and rules to infer new facts and then you just ask it questions. You don't tell it how to figure out the answers. Instead, it can figure them out for itself.

I actually laughed out loud about the shaved part - guess it helps to start with a simpler explanation.

I can see how it's kind of neat, especially getting computers to figure things out. I'm still stuck at seeing this, though, as a static set of switches. How is it learning or going beyond what you provide it? I mean, it seems like you're still having to provide a lot. When you say another mammal, it's only b/c you ruled that mammals have fur (and aren't shaved) that the mammal is furry. But you're st