On Mon, 7 Jul 2008, fero wrote:

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.

Are you talking about logic programming and PROLOG?
$ pl  # swi-prolog

?- plus(X,2,3).

X = 1 ;

No
?- plus(1,X,3).

X = 2 ;

No
?- plus(1,2,X).

X = 3 ;

No


Actually the type system of Haskell is also logic programming. I have implemented a simple kind of logic programming using lazy peano numbers:
  http://darcs.haskell.org/unique-logic/
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to