Search code examples
swi-prologprolog-toplevel

SWI-Prolog how to show entire answer (list)?


I'm trying to convert a string to a list of ascii-codes like so:

7 ?- string_to_list("I'm a big blue banana in space!", C).
C = [73, 39, 109, 32, 97, 32, 98, 105, 103|...].

8 ?- 

This doesn't give me the entire list as you can see, but I need it.

This solution does not work: I can't press w since it gives me the answer and does a full stop. Neither does this: I can call the function alright, and it returns true, but the list still isn't fully displayed.

11 ?- set_prolog_flag(toplevel_print_options,[quoted(true), portray(true), max_depth(0), spacing(next_argument)]).
true.

12 ?- string_to_list("I'm a big blue banana in space!", C).
C = [73, 39, 109, 32, 97, 32, 98, 105, 103|...].

13 ?- 

Any help appreciated!


Solution

  • ?- set_prolog_flag(answer_write_options,[max_depth(0)]).
    true.
    
    ?- string_to_list("I'm a big blue banana in space!", C).
    C = [73,39,109,32,97,32,98,105,103,32,98,108,117,101,32,98,97,110,97,110,97,32,105,110,32,115,112,97,99,101,33].
    

    there should be somewhere here on SO the same answer... I'm using the last SWI-prolog release, just compiled...