A particular 'splitting' problem
From: Eddie Jobson (mirrormaze_at_inwind.it)
Date: 03/09/05
- Next message: emukang: "how to use prolog in the gift system"
- Previous message: Jan Wielemaker: "Re: List cons functor (was Re: The meaning of module overriding syntax mod:goal in different Prologs)"
- Next in thread: Nameless: "Re: A particular 'splitting' problem"
- Reply: Nameless: "Re: A particular 'splitting' problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 9 Mar 2005 07:23:48 -0800
Suppose I have a prolog program, and I want to extract all the bodies
related to a particular head. I used the query:
setof(Body, clause(Headname, Body), Output).
How can I obtain a list from Output where every element is exacly a
single literal?
Quick example:
...
can_read(Book) :- available(Book).
can_read(Book) :- stock(Book), x(Book).
can_read(Book) :- a(Book), b(Book), c(Book).
...
the query above gives
Output = [available(_G441), (a(_G441), b(_G441), c(_G441)),
(stock(_G441), x(_G441))]
but I need:
[available(_G441), a(_G441), b(_G441), c(_G441), stock(_G441),
x(_G441)]
Thanks in advance!
- Next message: emukang: "how to use prolog in the gift system"
- Previous message: Jan Wielemaker: "Re: List cons functor (was Re: The meaning of module overriding syntax mod:goal in different Prologs)"
- Next in thread: Nameless: "Re: A particular 'splitting' problem"
- Reply: Nameless: "Re: A particular 'splitting' problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|