On Thursday 04 November 2010 5:13:23 pm Gregory Crosswhite wrote:
>   On 11/02/2010 08:37 PM, wren ng thornton wrote:
> > Indeed. If your program requires unification or constraint solving
> > then logic programming or constraint programming[1] is the way to go.
> 
> Would you be kind enough to give me or point me towards a good example
> of such a case?  I've been trying to understand what the point of logic
> languages is for a while now, but whenever I look at them I have trouble
> seeing what exactly it is they offer that solves some problems
> better/more easily than functional languages.

Implementing type inference can be very easy in a logic language, because most 
of the work in a non-logic language is implementing unification:

  http://muaddibspace.blogspot.com/2008/01/type-inference-for-simply-typed-
lambda.html

3 lines of Prolog to infer types for the simply typed lambda calculus with 
meta-variables (not counting the operator fixity declarations). I've written 
something similar in Haskell, and it's more like 80 lines of real code, a lot 
of which is implementing things that are simply part of Prolog's computation 
model.

-- Dan
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to