How to return clause in findall/3

From: rhapsody (blurrynight_at_yahoo.com)
Date: 08/12/04


Date: Wed, 11 Aug 2004 21:58:12 -0400

Hi, I am new to Prolog. What is the correct way of returning a list of
clauses 'sc/3' to the variable X? Below is my codes:
Database
sc(symbol Sid,symbol Cid, integer ExamScore).

Clauses
sc("S1","C1",55).
sc("S1","C2",60).
sc("S1","C3",70).
Goal
findall(sc(),sc(X,_,_),List), X="S1", write(List), nl.

Thanks in advance!
Stanly



Relevant Pages

  • Re: SQL Newbie - Join Question
    ... > I have a table with codes in it and I want to return the lookup values ... A regular JOIN would get me one of the two ... > different WHERE clauses on the same table. ...
    (microsoft.public.sqlserver.programming)
  • Re: With File in Turbo Prolog
    ... My codes were revised into the followings: ...
    (comp.lang.prolog)
  • Re: Out of local stack? (SWI)
    ... that your clauses go from the most spécific case to the most général ... all the lines 'Ontimer" and see wich one is always choosen..... ... >>and standard Prolog is pretty simple minded. ...
    (comp.lang.prolog)
  • question about last call optimization
    ... I have a question about last call optimization using euclids algorithm ... Okay the prolog literature gives the procedure as: ... Now will prolog "last call optimize" this. ... What about if we switch the order of the clauses as such: ...
    (comp.lang.prolog)
  • Re: The Da Vinci Code.
    ... Prolog language which just don't stand up in practice. ... get experienced, you realize that most clauses *are*, in fact, ...
    (alt.usage.english)