[plt-scheme] ANN: Parenlog

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Wed Mar 3 17:51:40 EST 2010

One of the biggest annoyances for me when I teach PLAI is finding a
sensible Prolog environment that is easy for students to use and fits
with what I've been doing in the beginning of the semester.

Naturally, this itch has led to another Prolog implementation:

http://planet.plt-scheme.org/display.ss?package=parenlog.plt&owner=jaymccarthy

Here's an example from the documentation [1]

Here is a sample module:
  #lang planet jaymccarthy/parenlog:1:0
  (type Gamma numConst num)
  (type Gamma boolConst bool)

  (:- (type Gamma (if Test Then Else) Tau)
      (type Gamma Test bool)
      (type Gamma Then Tau)
      (type Gamma Else Tau))

  (? (type mt numConst num))
  (? (type mt (if boolConst numConst numConst) num))
  (? (type mt (if boolConst numConst boolConst) num))

  (? (type mt boolConst T))
  (? (type mt (if boolConst numConst numConst) T))
  (? (type mt (if boolConst numConst boolConst) T))

If this module is evaluated, it prints:
  yes
  yes
  no
  T=bool
  T=num
  no

We can then query the model from the REPL:

  > next
  done
  > (type mt T num)
  T=numConst
  > next
  T=(if boolConst numConst numConst)
  > next
  T=(if boolConst numConst (if boolConst numConst numConst))

Enjoy!

Jay

1. http://planet.plt-scheme.org/package-source/jaymccarthy/parenlog.plt/1/0/planet-docs/parenlog/index.html

-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay

"The glory of God is Intelligence" - D&C 93


Posted on the users mailing list.