This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
10
tail call optimization question. possible bug in gprolog.
Post Body
in gprolog.
infinite_loop :-
[1] = [1],
infinite_loop.
same(A, A).
crashes :-
same([1], [1]),
crashes.
infinite_loop
never terminates, but crashes
overflows the memory and crashes. Even though they are clearly the same thing.
I guess infinite_loop
is able to be tail call optimized, but crashes
cannot. But I can't understand why?
My goal is to have a tail-call optimized recursive function, and inside of it I am calling a predicate that instantiates a list.
Thank you for helping.
Author
Account Strength
100%
Account Age
11 years
Verified Email
Yes
Verified Flair
No
Total Karma
2,273
Link Karma
1,725
Comment Karma
520
Profile updated: 3 days ago
Posts updated: 9 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 4 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/prolog/comm...