Ok tank you. So, is there a way to use this usefull library into GNU Prolog?
Selon Paulo Moura <[email protected]>: > > On 2010/06/09, at 18:00, [email protected] 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:[email protected]> > > Home page: <http://www.di.ubi.pt/~pmoura> > Research: <http://logtalk.org/> Blog: <http://blog.logtalk.org/> > ----------------------------------------------------------------- > > > _______________________________________________ > Users-prolog mailing list > [email protected] > http://lists.gnu.org/mailman/listinfo/users-prolog > _______________________________________________ Users-prolog mailing list [email protected] http://lists.gnu.org/mailman/listinfo/users-prolog
