[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 18:07:10 +0100 |
On 2010/06/09, at 18:00, address@hidden wrote:
> maplist/2 is a built-in predicate in SWI Prolog.
Wrong, is a library predicate:
$ swipl
...
For help, use ?- help(Topic). or ?- apropos(Word).
?- predicate_property(maplist(_,_), P).
P = interpreted ;
P = imported_from(apply) ;
P = transparent ;
P = (meta_predicate maplist(1, ?)) ;
P = file('/opt/local/lib/swipl-5.11.1/library/apply.pl') ;
P = line_count(157) ;
P = number_of_clauses(1) ;
false.
> I try this :
>
> %maplist(?P, ?L) : Apply the predicate P on each element in L
> maplist(P, []).
> maplist(P, [X|Xn]) :- call(P, X),maplist(P, Xn).
>
> But I get this :
> | ?- maplist(odd, [z]).
> no
Shouldn't the query be:
| ?- maplist(odd, [s(z)]).
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/>
-----------------------------------------------------------------