Suzanne L.
Suzanne L.

Reputation: 115

Applying predicates on a list in Prolog

I am a newbie in SWI-Prolog (5.10.5 running on win 7).

There are 3 files in an application that I am learning about: a.pl and b.pl and c.pl

a.pl uses the predicate foldl/4, which seems to be in apply.pl.

c.pl, uses the following:

:- ensure_loaded('a.pl').
:- ensure_loaded('b.pl').

and then calls some predicates in these files.

When I run c.pl, I get exception that foldl/4 is not defined. I tried adding the following to a.pl:

:- use_module(library(apply)).

and

:- [library(apply)].

but no use.

Could you help?

Thanks in advance Suzi

Upvotes: 2

Views: 419

Answers (1)

Edmund
Edmund

Reputation: 10829

I'm running 5.10.4 on Ubuntu, and my version does not have apply:foldl, though it does have most of the other predicates in apply. The online source shows that foldl was only added on 2012-06-05, but versions 5.10.X are over 2 years old.

So it looks like the online docs are for much newer versions, which you'd need to upgrade to to have this predicate.

Upvotes: 2

Related Questions