Re: How to return clause in findall/3

From: Jan Wielemaker (jan_at_ct.xs4all.nl)
Date: 08/13/04

  • Next message: Pere Montolio: "Re: How to return clause in findall/3"
    Date: 13 Aug 2004 11:59:59 GMT
    
    

    In article <d0867bad.0408130018.ed238df@posting.google.com>,
    Pere Montolio wrote:
    > "rhapsody" <blurrynight@yahoo.com> wrote in message
    news:<f58aded771bea22dbd46076ee25f9533@localhost.talkaboutprogramming.com>...
    >> Is it because I am using Visual Prolog? It gives error says 'variable
    >> expected' at the [A,B,C]
    >>
    >> findall([A,B,C],sc(A,B,C),List), write(List), nl.
    >
    >
    > It seems there are a difference between SWI and Visual. In Visual, try:
    > findall(A,sc(_,_,A),List).

    Nor the older de-facto standards nor the ISO standard pose any limit on
    the first argument of findall/3. You can even do

            findall(x, sc(A,B,C), L)

    and have a list [x, x, x, ...] with as many elements as there are
    _solutions_ to sc/3. Note solutions. to find the clauses you should
    do

            findall((sc(A,B,C):-Body), clause(sc(A,B,C), Body), Clauses).

            Cheers --- Jan


  • Next message: Pere Montolio: "Re: How to return clause in findall/3"