I have some simple code here:
main:-
read_string(user_input,"\n","\r\t",_,S),
split_string(S," ", "", Ls),
ask(Ls).
ask([First, Second|O]) :-
First = who,
Second = sells,
write(O).
The problem is when you type this:
?- main.
|:who sells fries
false.
?- ask([who, sells, fries]).
[fries]
true.
I want the 1st option to work like the second and I can't understand why it doesn't work. Shouldn't the "who sells fries" being queried through main be the same as just querying "ask" myself?
Am I missing some fundamental issue with functional programming (which I admit i'm really struggling with)?