Re: Dataflow variables
Carlo Capelli <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <CABty9wypKuZ_SnNNGivrZT800p_nRqJ5Eo8=c25u7_4bFQn-yg@mail.gmail.com> |
Hi Aleksey Nice question, but I don't feel able to answer adequately. Looking forward for some hint ! Anyway, I also think that coupling attributed variable with events will be much rewarding. As a preliminary test in fdqueens <https://github.com/CapelliC/fdqueens> I ported this <http://www.logic.at/prolog/queens/queens.html> CLP(FD) visualization ( thanks, Markus ! ). It also shows also to couple a SWI-Prolog engine (background threaded), into a Qt designed GUI. Prolog is held in .qrc resource file (a nice way to attach logic in a controlled way, I think). Also, pqConsole (supports HTML), allows for any custom output. Recently I've worked more on Qt reflection, and could be ready (almost :) to code in Prolog, without custom made C++... By now, having QtCreator installed it's almost a requisite to testing fdqueens, but I think QtCreator is charming, and I'm glad to ... spread the word ... It ( She ? Is an IDE of female gender ? ) really resorted my C++ feelings. I could be interested in your use case, if you are interested into this ( new ? ) route. bye Carlo 2013/11/3 Aleksey <[email protected]> > Hi guys > > I'm curious what is the easiest way to imitate dataflow variables in > Swi-Prolog > My current idea is something like this (pseudocode): > > wait_for(X) :- > freeze(X, awake_this_thread), > suspend_this_thread. > > test :- > do_work_in_separate_thread(Results), > wait_for(Results), > write(Results). > > I'm also interested if there is a way to make those predicates/functions > that > require some of their inputs to be bound to execute to automatically > suspend > until corresponding variables are bound, e.g.: > > test :- > bind_X_in_separate_thread_after_long_calculation(X), > Y is X+1, > write(X). > > (here I expect for "Y is X+1" to suspend until X gets bound). > -------------- next part -------------- > HTML attachment scrubbed and removed > _______________________________________________ > SWI-Prolog mailing list > [email protected] > https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog > -------------- next part -------------- HTML attachment scrubbed and removed