Re: Can you fold over solutions?

Paulo Moura <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
Hi Mark,

On 27/08/2013, at 17:32, Mark Green <[email protected]> wrote:

> Hi,
> 
> Is there any predicate which acts like a cross between foreach and foldl?
> In other words, it iterates through all solutions to a goal (like foreach)
> but can carry bindings from one iteration of the iterated predicate to the
> next (like foldl)?


Maybe something similar to map_reduce/5? See:

Interface:
https://github.com/LogtalkDotOrg/logtalk3/blob/master/library/metap.lgt

Implementation:
https://github.com/LogtalkDotOrg/logtalk3/blob/master/library/meta.lgt

Cheers,

Paulo


-----------------------------------------------------------------
Paulo Moura
Logtalk developer

Email: <mailto:[email protected]>
Web:   <http://logtalk.org/>
-----------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.