[m-users.] Display all predicate values

phiroc at free.fr phiroc at free.fr
Tue May 18 21:54:00 AEST 2021


Corrigendum: "but Who isn't an array". Sorry.

----- Mail original -----
De: "Philippe de Rochambeau" <phiroc at free.fr>
À: users at lists.mercurylang.org
Envoyé: Mardi 18 Mai 2021 13:47:13
Objet: [m-users.] Display all predicate values





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


More information about the users mailing list