Problem with setof and findall

I’m using: SWI-Prolog version - 8.1.5

I want the code to:

But what I’m getting is:

My code looks like this:

[1]  ?- findall(W, member(W, [a, b, params(c, d), d]), Ws).
Ws = [ab["a", "b", params("c", "d"), "d"].

Your posting is missing what you want the code to do, and your “My code looks like this” seems to have a copy&paste error.

findall/3 and bagof/3 are the inverses of member/2 (although things get a bit more complicated when there a universally or existentially qualified variables in the goals).
When I ran them, I got:

1 ?- findall(W, member(W, [a,b,params(c,d),d]), Ws).
Ws = [a, b, params(c, d), d].

2 ?- bagof(W, member(W, [a,b,params(c,d),d]), Ws).
Ws = [a, b, params(c, d), d].

My bad. It was caused by a portray/1.

Thanks, Peter.

Nan