Examples:
Input Prolog
Translated Output
What loop2 supports
- Rule A — facts to list predicate:
colour(red). colour(blue).→colours([red,blue]). - Rule B —
findall/3over a fact generator → explicitloop001/2recursion - Rule C — nested
findall+member/2flattened into a single loop - Rule D — simple one-clause predicate body spliced inline
- Transforms:
Y is X * 2,Y = f(X),Y = [X,X], etc. - Explicitly rejects:
!,;,->,\+,call/N, assert/retract, side-effects