[m-users.] Display all predicate values

Sean Charles (emacstheviking) objitsu at gmail.com
Tue May 18 21:53:06 AEST 2021


Try the solutions module.


> On 18 May 2021, at 12:47, Philippe de Rochambeau <phiroc at free.fr> wrote:
> 
> 
> Hello,
> what is the idiomatic way in Mercury to display all values that match the friend  predicate?
> 
> 
> :- pred friend(string).
> :- mode friend(out).
> friend("Mark").
> friend("Jack").
> friend("Andrew »).
> 
> main(!IO) :-
>   friend(Who),
>   lookup(Who, 1, Val),
>   io.write(Who, !IO).
> 
> 
> I’ve tried using lookup, but it’s Who is not an array.
> 
> Many thanks.
> 
> Best regards,
> 
> Philippe
> 
> 
> _______________________________________________
> users mailing list
> users at lists.mercurylang.org
> https://lists.mercurylang.org/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20210518/5390986f/attachment.html>


More information about the users mailing list