# My first useful prolog application

**URL:** <https://swi-prolog.discourse.group/t/my-first-useful-prolog-application/2249>\
**Category:** Announce\
**Created:** [April 28, 2020, 8:30pm UTC](https://swi-prolog.discourse.group/t/my-first-useful-prolog-application/2249 "2020-04-28T20:30:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [April 28, 2020, 8:30pm UTC](https://swi-prolog.discourse.group/t/my-first-useful-prolog-application/2249/1 "2020-04-28T20:30:48Z")

</div>

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](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](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
