[m-users.] Display all predicate values

Philippe de Rochambeau phiroc at free.fr
Tue May 18 21:47:13 AEST 2021


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


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


More information about the users mailing list