Is an infinite list of ones sane?
问题 In Prolog, is the unification X = [1|X] a sane way to get an infinite list of ones? SWI-Prolog does not have any problem with it, but GNU Prolog simply hangs. I know that in most cases I could replace the list with one(1). one(X) :- one(X). but my question is explicitly if one may use the expression X = [1|X], member(Y, X), Y = 1 in a "sane" Prolog implementation. 回答1: In Prolog, is the unification X = [1|X] a sane way to get an infinite list of ones? It depends on whether or not you consider