Gathering Solutions

From: Kareem Nutt (methodmano_at_gmail.com)
Date: 11/08/04

  • Next message: Kareem Nutt: "Subset Question"
    Date: Sun, 07 Nov 2004 18:06:52 -0500
    
    

    I have the following predicate that returns the following as an example:

    findPosSol(19,2,L).

    L = [1, 1, 3, 3, 11] ;

    L = [1, 1, 3, 5, 9] ;

    L = [1, 1, 3, 7, 7] ;

    L = [1, 1, 5, 5, 7] ;

    What I would like to do is of these four, find the correct solution to
    which I have the following predicate:

    sol(L,N).
    (prints out some stuff if solution is correct)

    How do I run each one of my possible solutions through sol(L,N). I
    tried using bagof and findall but they were returning things I didn't
    want (or I was using them wrong).

    Any help/ideas are greatly appreciated. Thanks!


  • Next message: Kareem Nutt: "Subset Question"

    Relevant Pages

    • Re: Gathering Solutions
      ... Kareem Nutt wrote: ... > I have the following predicate that returns the following as an example: ... > What I would like to do is of these four, find the correct solution to ... > Any help/ideas are greatly appreciated. ...
      (comp.lang.prolog)
    • Re: Trying to setup a hierarchy of classes of things (SWI prolog)
      ... Actually, the correct solution is even easier than this (often, the ... fails. ... current_has predicate at the very end, ... Your next question should be "succeeds at doing what?" ...
      (comp.lang.prolog)
    • Re: Help with a breadth first search in prolog.
      ... predicate for most Prologs), but rather that path/3 is not ... Notice that findall, as invoked by extend/2, will ... I'd guess that what you want is for it to find NewNode ... to which Instance binds when Goal succeeds. ...
      (comp.lang.prolog)
    • Re: Generics
      ... Damit erspare ich mit mehrer seperate Aufrufe von ConvertAll usw die ... ebenfalls für alle Möglichkeiten des FindAll ausgeführt werden sollen. ... Predicate das Mittel der Wahl). ...
      (microsoft.public.de.german.entwickler.dotnet.csharp)
    • Re: list with all the combinations of the initial list elements
      ... So I will to explain you what I want to do with the findall result. ... With your predicate I can find a combination between the list ... my laboratory there isn't someone who works with Prolog. ...
      (comp.lang.prolog)