Functional programming languages and Qt



  • hi,

    anyone had any experience mixing functional languages and Qt. Maybe we need some bindings for these as well.



  • I know some are using Haskell with Qt; http://qthaskell.berlios.de/



  • Indeed, this Haskell binding of Qt is quite nice. We don't feel exactly like when we're using Qt in C++, but still it exists. Moreover, the next version should include a binding to the Qt Quick technology, and the project will become more open.

    I used it a bit and I found it to be very nice, although there are some design decisions that I do not get perfectly, but I haven't investigated it that much.



  • Does anyone know of any project working on Scheme/LISP bindings for Qt?





  • I briefly looked around for OCaml bindings a while back and I came across this project:
    http://qt-caml.crapulion.org/trac

    It doesn't seem very active right now and I haven't tried it yet.



  • Just ran across CommonQt for Lisp:
    http://common-lisp.net/project/commonqt/

    Haven't had the pleasure of hacking Lisp yet, so someone else will know if this is cool or not.



  • Wow this is sweet. I'll have to check this out one day(TM).



  • There is also "EQL" (a Qt binding embedded in ECL: a Common Lisp which compiles to C).

    It can be used as a Qt binding, and additionally it can easily be embedded in C++ (direct function calls in both directions).

    http://gitorious.org/eql/pages/Home



  • perhaps some what obvious but you can use Scala with Qt Jamibi (http://qtjambi.sourceforge.net/)

    Richard D



  • The problem with Scala+Jambi is that the Qt classes (for example for collections) are not scala's collections and they will not have folds and similar.

    I'm currently working on a small Qt addon library [1] to allow you to develop in Qt/C++ with some of the funtional concepts.

    It will have greedy and lazy evals for most of the things, and whatnot. It is currently not in open development, but it will become soon, and it will be published under LGPL or some BSD-like license.

    Obviously, this is not really a functional language, but lambdas in C++2011 brought some new very nice possibilities.

    [1] http://ivan.fomentgroup.org/blog/category/qt-functional/



  • New C++ standard defines lambda support, so you will have Qt with functional language integrated... for free!! :-)
    You have to wait only for a little time...



  • Not really, if Qt doesn't have the APIs for lambdas and functors, you will not have too many places to use lambdas in your code.

    At the moment, there's work being done for QObject::connect to work with lambdas. Lets hope it will get into Qt 5.



  • Anyone tried using Qt Jambi with "clojure":http://clojure.org?



  • [quote author="Ivan Čukić" date="1312874479"]Not really, if Qt doesn't have the APIs for lambdas and functors, you will not have too many places to use lambdas in your code.

    At the moment, there's work being done for QObject::connect to work with lambdas. Lets hope it will get into Qt 5.[/quote]

    And of course, you will be able to use them with QtConcurrent (works fine already with Boost's implementation). What is missing, do you think?



  • [quote author="Andre" date="1314860619"]What is missing, do you think? [/quote]

    The missing is the stuff that I'm trying to address with QtFunctional - functional way of dealing with the collections - stuff like list.filter(some lambda), ... lazy evaluation for things ...



  • [quote author="Ivan Čukić" date="1314867006"][quote author="Andre" date="1314860619"]What is missing, do you think? [/quote]

    The missing is the stuff that I'm trying to address with QtFunctional - functional way of dealing with the collections - stuff like list.filter(some lambda), ... lazy evaluation for things ...

    [/quote]

    If you get anything usable done, maybe we could generate Jambi bindings for it... So those using Scala could use this, or maybe in Java, hack some support for it somehow... Would be very interest at least.

    Java 8 is said to get lambdas, so atleast something can be done, if not doing anything for actual model Jambi works for example with signals and slots.



  • Not sure how plusable would jambi bindings for this be since the library is overly template based, but yes, if it turns out to be possible, scala+qt would be quite awesome.



  • Templates just need manual mapping; if there is common idiom, I guess some kind of automation could be done for common types... All speculation without the library to convert, though :)



  • I have no clue how would you map things, but from my standpoint, it doesn't seem possible. Templates here are used for things that java generics can't do... heck, not even all C++ compilers can process the code :)

    The library is at http://gitorious.org/qt-functional

    Not sure how many more improvements it will receive in the next period. Hoping I'll have the times to work on it again in a few months.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.