[mercury-users] Doing something with all solutions

Paul Bone pbone at csse.unimelb.edu.au
Thu Jul 19 09:57:21 AEST 2007


On 19/07/2007, at 9:41 AM, Nikolas Everett wrote:

> I'm sure you get this a lot, but how can I ask Mercury to do  
> something with all the solutions that it finds for some predicate?   
> At this point I'd just like to print out all of my solutions, but  
> I'm sure there are better things to do then that.
>
> I've started with one of the programs in the Ralph Becket's  
> tutorial and produced the below.  I've messed around a little with  
> the solutions module, but haven't gotten any where.
>
> Thanks in advance, and sorry to bother the list with what feels  
> like a newbie question.  If answers to questions like these can be  
> found somewhere, please let me know where to look.
>

When I started using mercury I wrote a program to solve the 8 queens  
problem (See attached), I used the solutions predicate which gives a  
list of the solutions of a closure.  But the way I printed them out  
isn't very good, I believe I should have used map.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: queens.m
Type: application/octet-stream
Size: 2272 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/users/attachments/20070719/974b76f3/attachment.obj>
-------------- next part --------------




-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mercurylang.org/archives/users/attachments/20070719/974b76f3/attachment.sig>


More information about the users mailing list