[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Where is the maplist built-in predicate ?
From: |
Paulo Moura |
Subject: |
Re: Where is the maplist built-in predicate ? |
Date: |
Wed, 9 Jun 2010 17:24:07 +0100 |
On 2010/06/09, at 17:17, address@hidden wrote:
> Hello,
>
> I am using GNU Prolog 1.3.1.
>
> I use this code :
>
> % int(?I) : I is an integer
> int(z).
> int(s(X)) :- int(X).
>
> % odd(?I) : I is an odd integer
> odd(s(z)).
> odd(s(s(X))) :- odd(X).
>
> % intzodd(?I) : I is an odd integer or zero (z)
> intzodd(X) :- X=z.
> intzodd(X) :- odd(X).
>
> % listzodd(?L) : L is a list which each element is an odd integer or zero (z)
> listzodd(X) :- maplist(intzodd, X).
>
> And I don't find the maplist built-in predicate.
>
> | ?- listzodd([z]).
> uncaught exception: error(existence_error(procedure,maplist/2),listzodd/1)
>
> Where is the maplist built-in predicate, please?
maplist/2 is not a built-in predicate in GNU Prolog and, as far as I know, in
any other Prolog compiler. Some Prolog compilers, however, provide it in a
library. You will need to define it yourself. Is easy.
Cheers,
Paulo
-----------------------------------------------------------------
Paulo Jorge Lopes de Moura, PhD
Assistant Professor
Dep. of Computer Science, University of Beira Interior
6201-001 Covilhã, Portugal
Office 3.18 Ext. 3276
Phone: +351 275319891 Fax: +351 275319899
Email: <mailto:address@hidden>
Home page: <http://www.di.ubi.pt/~pmoura>
Research: <http://logtalk.org/> Blog: <http://blog.logtalk.org/>
-----------------------------------------------------------------