Re: [eclipse-clp-users] Request for code review

From: Sergey Dymchenko <kit1980_at_...6...>
Date: Mon, 30 May 2011 02:23:44 +0300
Thanks!
In fact, there can be only 1 or 0 solutions to the problem.

On Mon, May 30, 2011 at 1:55 AM, Joachim Schimpf
<joachim.schimpf_at_...269...> wrote:
> Sergey Dymchenko wrote:
>> Joachim, thanks for your review, it's really helpful!
>>
>> Also recently I read about shelves.  The tutorial says: "A typical
>> application is counting of solutions...".
>> So I think using shelf object to writeln "-1" in case there is no
>> solution is a good idea. Am I right?
>
> >From an efficiency point of view, yes.  Some examples are here
> http://eclipseclp.org/doc/bips/kernel/storage/shelf_create-2.html
>
> The reason I gave the findall-based solution was that it is the
> textbook solution, and would work in all Prolog implementations.
>
> Another possibility is
> http://eclipseclp.org/doc/bips/kernel/control/X-G-2.html
>
> Note that, if you were not interested in multiple solutions,
> you could have simply written
>
>    ( solve(...) -> writeln(...solution...) ; writeln(-1) ).
>
>
> -- Joachim
>
>
> ------------------------------------------------------------------------------
> vRanger cuts backup time in half-while increasing security.
> With the market-leading solution for virtual backup and recovery,
> you get blazing-fast, flexible, and affordable data protection.
> Download your free trial now.
> http://p.sf.net/sfu/quest-d2dcopy1
> _______________________________________________
> ECLiPSe-CLP-Users mailing list
> ECLiPSe-CLP-Users_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users
>
Received on Sun May 29 2011 - 23:23:50 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST