func icon indicating copy to clipboard operation
func copied to clipboard

functions inside forall, foreach, findall, bagof, etc.

Open mndrix opened this issue 11 years ago • 1 comments

Expanding a function inside the goal argument of these predicates should keep the entire expansion inside the predicate. Currently it moves the expansion outside the predicate.

mndrix avatar May 27 '14 22:05 mndrix

A concrete example of the problem:

$ cat expand.pl
:- use_module(library(func)).
nmain :-
    bagof(x,between(1,succ(2,~),_),Xs),
    writeln(Xs).

$ swipl -q -s expand.pl
1 ?- listing(main).
main :-
    succ(2, A),
    bagof(x, between(1, A, _), B),
    writeln(B).

true.

The listing should have been as follows:

main :-
    bagof(x, (succ(2,A),between(1, A, _)), B),
    writeln(B).

mndrix avatar Oct 28 '16 23:10 mndrix