Reputation: 572
I am learning Prolog and .(a,[]) == [a]. should return true in SWI-Prolog, but it gives me an error saying
ERROR: Type error: `dict' expected, found `a' (an atom)
ERROR: In:
ERROR: [11] throw(error(type_error(dict,a),_4020))
ERROR: [10] '$type_error'(dict,a) at /Applications/SWI-
Prolog.app/Contents/swipl/boot/init.pl:3369
ERROR: [9] '$dicts':'.'(a,[],_4086) at /Applications/SWI-
Prolog.app/Contents/swipl/boot/dicts.pl:46
ERROR: [8] '<meta-call>'(user:(...,...)) <foreign>
ERROR: [7] <user>
Anyone knows how to fix this?
Upvotes: 2
Views: 105
Reputation: 71119
Start the SWI Prolog executable with the --traditional
command line option (comment due to user:false).
Then it works:
1 ?- .(a,[]) == [a]. true. 2 ?- current_prolog_flag( traditional, X). X = true. 3 ?- set_prolog_flag( traditional, false). ERROR: set_prolog_flag/2: No permission to modify flag `traditional' 4 ?-
This is mentioned in the documentation here (see "traditional", near the bottom of the page).
As can be seen, attempting to change it from within the running SWI session, fails.
Upvotes: 2