I am trying to create an executable of following Prolog code:
item(one, 50, 40).
item(two, 80, 70).
item(three, 100, 55).
item(four, 50, 45).
maxMeanStudy:-
findall(M,item(_,M,_),L),
max_member(Max,L),
write("Maximum mean value:"), % this line is not printed properly.
writeln(Max),!.
main:-
maxMeanStudy.
I am using following command to create executable as mentioned on this page: http://www.swi-prolog.org/pldoc/man?section=cmdlinecomp
$ swipl --goal=main --stand_alone=true -o myprog -c myques.pl
The executable created does not write the string "Maximum mean value:" in letters but writes it in codes:
$ ./myprog
[77,97,120,105,109,117,109,32,109,101,97,110,32,118,97,108,117,101,58]100
I am working on Linux (32bit). How can I solve this problem. Thanks for your help.
double_quotesflag is reverted tocodes. So your quick fix might be to either (a) include the directive,:- set_prolog_flag(double_quotes, string).at the beginning of your file, or (b) use single quotes for your strings so they are just atoms (then you don't have to worry about double quote interpretation). Of course, the best approach is (c) heed the answer @mat gave you. - lurker