users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where is the maplist built-in predicate ?


From: spam . spam . spam . spam
Subject: Re: Where is the maplist built-in predicate ?
Date: Wed, 09 Jun 2010 19:11:50 +0200
User-agent: Internet Messaging Program (IMP) 3.2.8

Ok tank you.
So, is there a way to use this usefull library into GNU Prolog?

Selon Paulo Moura <address@hidden>:

>
> 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/>
> -----------------------------------------------------------------
>
>
> _______________________________________________
> Users-prolog mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/users-prolog
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]