Search code examples
prologgnu-prolog

maplist raises uncaught exception: error(existence_error(procedure,maplist/2),top_level/0)


The following used maplist works in swi-prolog not in gprolog:

GNU Prolog 1.3.1
By Daniel Diaz
Copyright (C) 1999-2009 Daniel Diaz
| ?- maplist(writeln,[1,2,3]).
uncaught exception: error(existence_error(procedure,maplist/2),top_level/0)
| ?-

Solution

  • I've just tested it on my gprolog:

    GNU Prolog 1.4.1
    By Daniel Diaz
    Copyright (C) 1999-2012 Daniel Diaz
    | ?- maplist(write,[1,2,3]).  
    123
    

    Therefore maplistis defined in newer versions.

    Please also note that there is no writeln in gprolog, so if you need it, you will have to define it first.