On Mon, 7 Jul 2008 02:57:25 -0700 (PDT), fero <frantisek.kocun@gmail.com> wrote: If you are interested in logic programming in a language with some similarity to Haskell, you might also wish to investigate the strongly typed logic programming language Godel (see http://www.cs.bris.ac.uk/~bowers/goedel.html). When I first saw an example of the code, I was surprised that, unlike Prolog, the language was strongly typed, and supported modules, and (albeit very loosely) resembled Haskell, except that it was a logic programming language. Here is an example of a program in Godel to compute a greatest common divisor (note the strong typing and usage of a module system) (see http://www.cs.bris.ac.uk/~bowers/goedel-example.html): MODULE GCD. IMPORT Integers. PREDICATE Gcd : Integer * Integer * Integer. Gcd(i,j,d) <- CommonDivisor(i,j,d) & ~ SOME [e] (CommonDivisor(i,j,e) & e > d). PREDICATE CommonDivisor : Integer * Integer * Integer. CommonDivisor(i,j,d) <- IF (i = 0 \/ j = 0) THEN d = Max(Abs(i),Abs(j)) ELSE 1 =< d =< Min(Abs(i),Abs(j)) & i Mod d = 0 & j Mod d = 0. According to the home page for the language,
Go"del is a declarative, general-purpose programming language in the family of logic programming languages. It is a strongly typed language, the type system being based on many-sorted logic with parametric polymorphism. It has a module system. Go"del supports infinite precision integers, infinite precision rationals, and also floating-point numbers. It can solve constraints over finite domains of integers and also linear rational constraints. It supports processing of finite sets. It also has a flexible computation rule and a pruning operator which generalises the commit of the concurrent logic programming languages. Considerable emphasis is placed on Go"del's meta- logical facilities which provide significant support for meta-programs that do analysis, transformation, compilation, verification, debugging, and so on.
-- Benjamin L. Russell
Hi I have read in one tutorial (I can't find it again, but it was probably either one on ibm, gentle introduction or yaht), that it is possible to define relationships between free variables and the same program can be used to calculate either first variable when second is set or second when first is set. I have understood this as if I set first free variable, run program and write name of second variable and I get result, and vice versa. I don't know if I understood it well. It looks really interesting but I can't figure out how to do it. Is this really possible? (I doubt.) If yes show example please.
Thanks Fero