-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
iProlog/IP/src/iProlog/Engine.java
Lines 870 to 876 in 62b20e6
| final int[] gs = pushBody(b, head, C0); | |
| final IntList newgs = IntList.tail(IntList.app(gs, IntList.tail(G.gs))); | |
| G.k = k + 1; | |
| if (!IntList.isEmpty(newgs)) | |
| return new Spine(gs, base, IntList.tail(G.gs), ttop, 0, cls); | |
| else | |
| return answer(ttop); |
This looks like a very expensive way of computing
(gs.length > 1) || (G.gs.length > 1)
as IntList newgs is otherwise unused?
Just seeking to understand why this is written this way, as I am in the process of converting the engine into the Lua language (what else to do in lockdown?) Preliminary speed tests are very encouraging. This whole implementation (plus the "Hitchhiker" paper, and the YouTube tutorial) is otherwise wonderfully clear and straight-forward.
Thanks for your work, I had been looking for a compact Prolog implementation for quite a while!
Tony
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels