I wanted to share a story and would like to have your opinion on this.
I recently passed my prolog exam at Uni, During which i was asked to write a predicate to invert a list.
I came up with something like this:
rev(A,B):- rev(A,B,). rev(,B,B):-!. rev([X|A],B,C):- rev(A,B,[X|C]).
He hated this code and said that writing an accumulator in prolog meant i did not really understand the “soul” of prolog which is purely predicative: he argued that you should be able to read every predicate in a way that makes logical sense such as “rev(A,B) is true if B is the reverse of A” and that rev(A,B,C) simply did not make logical sense.
He asked me to write it without an accumulator and with only two arguments, i panicked and ended up with a very low grade.
What is your opinion on this? Is he right? Or is this an exaggerated scholastic approach to the language?