drt24 / gnuprologjava

GNU Prolog for Java
8 stars 5 forks source link

member(X, <anything which is not a list>) raises an ArrayIndexOutofBounds exception, but instead should fail #29

Closed thetrime closed 6 years ago

thetrime commented 7 years ago

The ISO standard seems to imply that member/2 should be defined as if ``` member(X, [X|]). member(X, [|Y]):-member(X,Y).


(and indeed, Predicate_member.java includes this in the javadoc). However, the implementation assumes that the second argument of a list cell is either an emptyListAtom or another list. While this /should/ be the case, we should cater for the case where it is not