Most useful and instructive functional-logic language to learn

 ̄綄美尐妖づ 提交于 2019-12-20 19:43:14

问题


I was pretty amazed by the power of Prolog. It took some time to get the head around, but to me it seemed to be the coolest declarative language out there. That's why recently, after two years of some functional programming with Scala, I decided to take a look at logical programming again, to "train my brain" or better for actual usage.

Combining functional and logical programming seems attractive for me to learn/solidify concepts of both declarative paradigms. I find also find strong type systems very useful and fascinating.

Scala really shined with interop. Let's not reinvent wheels. It should be able to call code in another main language, and preferable also to be callable. But it doesn't have to be Java. C or Haskell would be ok too.

So, which are the most useful and enlightening FLP languages today, and what are your opinions and recommendations on them?

Here is what I found so far:

  1. Mercury: claims to be fast, strongly typed Prolog. Pure declarative, but no logical variables! No constraint programming? Seems to be the most widely used FLP. Interop??

  2. Curry: seems promising and the most advanced, but right now a bit low on documentation. Does "experimental" mean immature/not ready to dive into? just based on Haskell or actually good interop with Haskell?

  3. Ciao: seems to provide many features I want, but Stack Overflow doesn't even seem to know it at all, although it exists since 1984? What's wrong with it? Interop?

  4. drools (java library/DSL): claims it allows hybrid forward- and backward chaining. Mature. Direct interop with Java/Scala, but relying on mutable data / imperative constructs? How well does it integrate with functional JVM languages?

  5. miniKanren: implementations exist on several platforms. How is interop? Efficient?

  6. Lambda Prolog implementations such as:

    1. Caledon: Might be nice, but heavy theory. Usefulness? Effective interop with Haskell? Documentation?

    2. Teyjus. similar to Caledon.

Good but theoretic reads and biased towards curry and not addressing practical concerns:

  • http://doi.acm.org/10.1145/1721654.1721675

  • http://www.informatik.uni-kiel.de/~mh/slides/ETAPS00.pdf


回答1:


I can give you a (slightly) biased recommendation for Curry.

As you already mentioned, Curry is quite advanced and, while still experimental, definitely ready to be used. There are already applications in productive use. You won't find many reads on practical aspects since Curry is mainly a research language. However, there is a small but helpful community reading and answering the Curry Mailing List:

http://www-ps.informatik.uni-kiel.de/currywiki/documentation/mailing

Regarding interoperability, there seem to be two choices: The Münster Curry Compiler(MCC) supports a subset of the Haskell foreign function interface to call C code.

The most recent Curry implementation, the Kiel Curry System 2 (KiCS2), compiles Curry to Haskell. There is a schematic way to call Haskell Code from Curry when using KiCS2 (see the KiCS2 Manual, Appendix D). Unfortunately, I am not aware of a way to call Curry code from another language.




回答2:


The most profoundly useful nexus of FP and LP has been, as far as I've found, Mercury + Erlang. Both are incidentally interesting from an academic point of view (you really do need to have your fundamentals straight if you want to do good things with either, or both), but both also place a premium on getting products to market and maintaining them as opposed to being research oddities.

I'm not really sure if the OP was weighting "useful" greater than "instructive", and I also don't know if "useful" means "code that usefully solves problems in the real world". But assuming that this is part of the criteria here, Mercury + Erlang is by far the most interesting combination of LP and FP to be had at the moment.



来源:https://stackoverflow.com/questions/17675133/most-useful-and-instructive-functional-logic-language-to-learn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!