This is a constraint establishing equality between a collection-valued expression and a list containing the same elements as the collection. Evaluation delays if arguments are insufficiently instantiated.
A "collection" can be either of the following data terms:
?- List=[a,b,c,d], eval_to_list(List, Result). Result = [a, b, c, d] ?- Arr=[](a,b,c,d), eval_to_list(Arr, Result). Result = [a, b, c, d] ?- Arr=[](a,b,c,d), eval_to_list(Arr[2..3], Result). Result = [b, c] ?- Mat=[]([](a,b,c),[](d,e,f)), eval_to_list(Mat, Result). Result = [[](a, b, c), [](d, e, f)] ?- Mat=[]([](a,b,c),[](d,e,f)), eval_to_list(concat(Mat), Result). Result = [a, b, c, d, e, f] ?- Mat=[]([](a,b,c),[](d,e,f)), eval_to_list(Mat[1], Result). Result = [a, b, c] ?- Mat=[]([](a,b,c),[](d,e,f)), eval_to_list(Mat[1,*], Result). Result = [a, b, c] ?- Mat=[]([](a,b,c),[](d,e,f)), eval_to_list(Mat[*,2], Result). Result = [b, e] ?- Mat=[]([](a,b,c),[](d,e,f)), eval_to_list(Mat[1..2,2], Result). Result = [b, e] ?- Mat=[]([](a,b,c),[](d,e,f)), eval_to_list(Mat[1..2,2..3], Result). Result = [[](b, c), [](e, f)] ?- Mat=[]([](a,b,c),[](d,e,f)), eval_to_list(concat(Mat[1..2,2..3]), Result). Result = [b, c, e, f] ?- NL = [a,b,[c,d]], eval_to_list(NL, Result). Result = [a, b, [c, d]] ?- NL = [a,b,[](c,d)], eval_to_list(NL, Result). Result = [a, b, [](c, d)] ?- NA = [](a,b,[c,d]), eval_to_list(NA, Result). Result = [a, b, [c, d]] ?- NA = [](a,b,[c,d]), eval_to_list(NA[3], Result). Result = [c, d] ?- Xs=[a,b], Yz=[](c,d), eval_to_list(Xs>>Yz, Result). Result = [a, b, c, d] % Error cases where collections expected ?- eval_to_list(no_collection, Result). No (0.00s cpu) ?- eval_to_list(99, Result). No (0.00s cpu) ?- eval_to_list(concat([[1],2,[3]]), Result). No (0.00s cpu) % Cases with insufficient instantiation: ?- eval_to_list(Xs, R). R = Xs % assumed to be a list (but no check) Yes ?- eval_to_list([1|Xs], R). R = [1|Xs] Yes ?- eval_to_list(Xs>>[3], R). R = R <delays until Xs instantiated> ?- eval_to_list([1]>>Ys, R). R = [1|Ys] % assumed to be a list (but no check) Yes ?- eval_to_list([1]>>Ys, R). R = [1|Ys] % assumed to be a list (but no check) Yes ?- Mat=[]([](a,b,c),[](d,e,f)), eval_to_list(Mat[I], R). R = R <delays until I instantiated> % Delayed instantiation of expression ?- eval_to_list(eval(X), [1,2,3]). X = X <delays until X instantiated> ?- eval_to_list(eval(X), Ys), X=[1]>>[2,3]. Ys = [1, 2, 3] ?- eval_to_list(eval(X), [1,2,3]), X=[](1,2,3). Yes % Reverse direction ?- eval_to_list(Xs, [1,2,3]). Xs = [1,2,3] Yes