The prolog example is maybe be tail-recursive depending on the implementation, but you pay for it with memory. There is a hole in the list, sort of anyway as it refers to an unbound logical variable which is not free.
The prolog example is maybe be tail-recursive depending on the implementation, but you pay for it with memory. There is a hole in the list, sort of anyway as it refers to an unbound logical variable which is not free.