I keep getting a syntax error every time I try to compile this buffer. I've gone through the ordinary steps of removing all spaces, but still I keep getting the same error every time.
solve_puzzle(Swimmers):-
Swimmers=[_Girl1,_Girl2,_Girl3],
[girl(_,_,_,first),girl(_,_,_,second),girl(_,_,_,third)]=Swimmers,
is_faster(girl(claudia,_,_,_),(_,_,cheltenham_girls,_),Swimmers),
is_faster(girl(mary,_,_,_),girl(_,table_tennis,_,_),Swimmers),
member(girl(_,weightlifting,_,first),Swimmers),
member(girl(mary,_,sydney_girls_high_school,_),Swimmers),
member(girl(claudia,ballroom_dancing,_,_),Swimmers),
member(girl(_,_,hornsby_girls_high_school,_),Swimmers).
is_faster(F,S,[F|[S|_]]).
is_faster(F,S,[F,S,[_|Rest]]):- is_faster[F,S,Rest).
Whats doing this? I seem to run into this every time I attempt prolog.
is_faster(F, S, [F,S,_|Rest]) :- is_faster(F, S, Rest).
to at least fix the syntax error (semantic problems may still be present). Removing all spaces is certainly not required or recommended. Also, check out more convenient list syntax: You can write the penultimate clause equivalently asis_faster(F, S, [F,S,_]).
(again, just considering syntax, and leaving the semantics unchanged). – mat Sep 15 '15 at 7:53