My first useful prolog application

Dear list,

I learned prolog in a seminar on cognitive psychology in 1995. Of course, I forgot everything again rather soon. Five years ago, I asked one of my students to show me how he calculates a t-ratio in statistics.

The formula is \frac{M - mu}{s / \sqrt(N)}. I use Latex notation to illustrate that it is a fraction (i.e., no visible parentheses). The student typed into his calculator: M - mu / s / sqrt(N), he obviously forgot the parentheses. I remembered my prolog seminar from 1995.

Now, after 5 years of development (with very irregular intensity), I am proud to announce my first prolog website that would immediately recognize the mistake of the student:

https://classking.vps.webdock.io/mcclass

The mathematical equations are most pretty if you use firefox, sorry for the other people. Source code: https://github.com/mgondan/mcclass. The program makes use of Prolog’s fine pattern-matching; otherwise it is (mostly) procedural.

Lesson learned: Use pure representations. They kinda replace the type system. With defaulty representations, cuts are needed all over the place, and the program becomes procedural. Correct me if I am wrong (I have no expertise whatsoever in logic programming).

Best wishes,

Matthias

7 Likes