
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 -- View this message in context: http://www.nabble.com/Interesting-feature-tp18311432p18311432.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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/

On Mon, 07 Jul 2008 12:30:34 +0200 (CEST)
Henning Thielemann
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/
There is also Curry which is basically Haskell extended with features from logic programming. There you get to use ordinary values instead of having to use types. However, it seems that Curry's solution finding mechanism is built-in to the language and cannot be modified (e.g. for performance reasons) without modifying the language implementation. (I think the same would be true for logic programming with Haskell types.) -- Robin

Robin Green wrote:
On Mon, 07 Jul 2008 12:30:34 +0200 (CEST) Henning Thielemann
wrote: 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/
There is also Curry which is basically Haskell extended with features from logic programming. There you get to use ordinary values instead of having to use types. However, it seems that Curry's solution finding mechanism is built-in to the language and cannot be modified (e.g. for performance reasons) without modifying the language implementation. (I
Actually, I think it can: http://dblp.uni-trier.de/rec/bibtex/conf/iclp/HanusS98 Also more recently, I heard of a way to abstract a nondeterministic Curry value into its explicit search tree, which one can then traverse to one's own liking. Obviously, people on the Curry list will know more about the details... Ciao, Janis. -- Dr. Janis Voigtlaender http://wwwtcs.inf.tu-dresden.de/~voigt/ mailto:voigt@tcs.inf.tu-dresden.de

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.
See also metafont, which defines equational relationships between variables and solves. Jules

Hi
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.
Here is how to do it in Haskell: http://portal.acm.org/citation.cfm?id=1291201.1291207 Thanks Neil

Thanks a lot Neil, I will definitely read it. I searched google and found the same article here for free http://www.cs.chalmers.se/~emax/wired/documents/LP_HFL07.pdf I didn't know that Haskell commuity is so alive. Much more answers in much less time than when I wrote something to jav:) Fero Neil Mitchell wrote:
Hi
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.
Here is how to do it in Haskell:
http://portal.acm.org/citation.cfm?id=1291201.1291207
Thanks
Neil _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- View this message in context: http://www.nabble.com/Interesting-feature-tp18311432p18314566.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

On Mon, 7 Jul 2008 02:57:25 -0700 (PDT), fero
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

On 08/07/2008, Benjamin L. Russell
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.
While we're plugging logic programming languages, you might also be interested in Mercury (http://www.cs.mu.oz.au/research/mercury/). This is a logic/functional language with Prolog-like syntax, but with a Haskell-like type system, including Hindley-Milner types and type classes. IMHO Mercury is even closer to Haskell than Goedel. Also, see my recent attempts at (constraint) logic programming in Haskell: http://overtond.blogspot.com/2008/07/pre.html http://overtond.blogspot.com/2008/07/haskell-sudoku-solver-using-finite.html David

On Tue, 8 Jul 2008 16:59:00 +1000, "David Overton"
On 08/07/2008, Benjamin L. Russell
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.
While we're plugging logic programming languages, you might also be interested in Mercury (http://www.cs.mu.oz.au/research/mercury/). This is a logic/functional language with Prolog-like syntax, but with a Haskell-like type system, including Hindley-Milner types and type classes. IMHO Mercury is even closer to Haskell than Goedel.
Yes, Mercury appears interesting, but I was also wondering whether there were any logic programming languages with strong typing and modules that have GUI-based REPL's, similar to WinHugs, available. For example, both SWI-Prolog and GNU Prolog have GUI-based REPL's of that type, but Mercury, at least from what I read in the on-line documentation, does not appear to have one. Go"del has SAGE (Self Applicable Go"del Evaluator) (download goedel-sage.tar.Z (200KB) at ftp://ftp.cs.bris.ac.uk/pub/goedel/latest/goedel-sage.tar.Z), but Go"del is not available for Windows, and according to the home page, there are no plans for this to change in the future. The advantage of a GUI-based REPL is that it facilitates learning the language for beginners and non-*NIX/Linux users, and, in some cases, using the language in a non-*NIX/Linux environment. For example, although I can use Mac OS X at home, my work computer, on which I study programming during lunch and after work, uses Windows XP Professional. It is clumsy switching to Cygwin and Emacs in a Windows environment, because I cannot use UNIX-style tools in the same way outside of Cygwin in Windows as in UNIX. In addition, many directories have spaces in their paths, and many UNIX tools do not support spaces in paths to files. In this environment, a GUI-based REPL would be convenient. Do you know of any logic programming languages with strong typing and modules that have GUI-based REPL's, similar to WinHugs, available? -- Benjamin L. Russell
Also, see my recent attempts at (constraint) logic programming in Haskell: http://overtond.blogspot.com/2008/07/pre.html http://overtond.blogspot.com/2008/07/haskell-sudoku-solver-using-finite.html
David

On 08/07/2008, Benjamin L. Russell
Do you know of any logic programming languages with strong typing and modules that have GUI-based REPL's, similar to WinHugs, available?
You might want to look at Visual Prolog (http://www.visual-prolog.com/). It is strongly typed and has a Windows IDE. I'm not sure if it has a REPL though. David

On Tue, 8 Jul 2008 16:59:00 +1000, "David Overton"
Also, see my recent attempts at (constraint) logic programming in Haskell: http://overtond.blogspot.com/2008/07/pre.html http://overtond.blogspot.com/2008/07/haskell-sudoku-solver-using-finite.html
Whoops! Sorry, I rushed to reply with my earlier message, and forgot to respond to this part of your post. Your blog posts about a Haskell Sudoku solver remind me of similar blog posts about Sudoku solvers in Python (see "Solving Every Sudoku Puzzle": http://norvig.com/sudoku.html) and Scheme (see "Schemely: Sudoku Solver1": http://www.bobmc.net/cgi-bin/Schemely.pl/Sudoku_Solver1, and "Schemely Blog: Scheme Sudoku Solver": http://schemely.blogspot.com/2006/02/scheme-sudoku-solver.html). Some programmers learn new languages by translating code for Sudoku solvers from one language that they already know well to another language that they are trying to learn. Because solving a Sudoku puzzle can be accomplished more easily by using constraint propagation, in which placing a constraint on one square can cause further constraints to be placed on other squares, this definition lends itself to constraint programming. Since constraint programming is a form of declarative programming, this form of programming lends itself to constraint logic programming. As an example, GNU Prolog has a constraint logic programming interpreter; however, GNU Prolog lacks strong typing. If you are interested in constraint programming, you may wish to investigate the multi-paradigm programming language Oz (see http://www.mozart-oz.org/), which can implement constraints in a functional programming language. The language lacks multiprocessor support, but supports declarative programming, object-oriented programming, constraint programming, and concurrency as part of a coherent whole. -- Benjamin L. Russell

David Overton wrote:
Also, see my recent attempts at (constraint) logic programming in Haskell: http://overtond.blogspot.com/2008/07/pre.html http://overtond.blogspot.com/2008/07/haskell-sudoku-solver-using-finite.html
See the Sudoku page on the wiki: http://www.haskell.org/haskellwiki/Sudoku Please add your solver there. Regards, Yitz

2008/7/9 Yitzchak Gale
David Overton wrote:
Also, see my recent attempts at (constraint) logic programming in Haskell: http://overtond.blogspot.com/2008/07/pre.html http://overtond.blogspot.com/2008/07/haskell-sudoku-solver-using-finite.html
See the Sudoku page on the wiki:
http://www.haskell.org/haskellwiki/Sudoku
Please add your solver there.
I've done that. Thanks. David
participants (9)
-
Benjamin L.Russell
-
David Overton
-
fero
-
Henning Thielemann
-
Janis Voigtlaender
-
Jules Bean
-
Neil Mitchell
-
Robin Green
-
Yitzchak Gale