Re: How to return clause in findall/3

From: Pere Montolio (tmp123_at_menta.net)
Date: 08/12/04

  • Next message: Pere Montolio: "Re: Append to list"
    Date: 12 Aug 2004 00:21:32 -0700
    
    

    "rhapsody" <blurrynight@yahoo.com> wrote in message news:<f12b89feca33ea7c0cce07b2be4719cf@localhost.talkaboutprogramming.com>...
    > 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

    It is posible one of the following rules was useful for your objectives:
    findall([A,B,C],sc(A,B,C),List).
    or
    findall([B,C],sc("S1",B,C),List).


  • Next message: Pere Montolio: "Re: Append to list"

    Relevant Pages

    • Re: How to return clause in findall/3
      ... > sc(symbol Sid,symbol Cid, integer ExamScore). ... There is no such thing as a list of clauses in that sense, ...
      (comp.lang.prolog)
    • Re: SQL syntax over a network
      ... You can code in one database, ... to using multiple IN clauses for the data source. ... 'working' example is for Jet SQL or ADO 'ANSI' SQL: ... database identifier is what goes in the first string literal ...
      (microsoft.public.access.modulesdaovba)
    • Re: Prolog type overloading
      ... If I have in my database next, it means ... nextclauses. ... It's not always clever to be clever. ... I would use different names for different predicates. ...
      (comp.lang.prolog)
    • Re: SQL syntax over a network
      ... You can code in one database, ... > to using multiple IN clauses for the data source. ... > database identifier is what goes in the first string literal ...
      (microsoft.public.access.modulesdaovba)
    • Re: embedded SQL in COBOL
      ... I can't imagine specifying 200 different fields in the ... If you have 10 fields in your database, and the last 5 can be null, you'll have something like... ... The most common way is a copybook - we have a working-storage copybook for the data layouts, and a procedure copybook to do the select. ... In our network database, the database is defined with picture clauses, like COBOL is. ...
      (comp.lang.cobol)