Re: Using foreach/2

Boris Vassilev <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAFw8osLv2E5WoLMDgnsyUTGeG-_=WsOXNivs4mnRXiE5muon_w@mail.gmail.com>
Hi,

I did try to look through the code and although I can see what happens I am
not sure I understand all of the implications of it. Either way, I managed
to understand that foreach/2 is definitely not meant to be used as in my
original mail.

On Fri, Mar 21, 2014 at 11:50 AM, Jan Wielemaker <[email protected]> wrote:

> I wonder however whether
> there is a set of neat higher oder predicates that could be used for
> processing compound terms?
>

This is what I was wondering exactly.... At some point some time ago I
noticed that arg/3 is really efficient with either the first or the third
argument (!) instantiated. So I am basically using a term as a "random
access" list, as this fits very nicely with the problem I was trying to
model.

So do you mean predicates with semantics similar to those in
library(lists), but applied on compound terms? How come those are not
readily available (or to rephrase, why hasn't anyone needed those)? There
certainly is some sort of gotcha?

Cheers,
Boris
-------------- next part --------------
HTML attachment scrubbed and removed
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.