Re: Iterative union



On 21 Feb, 11:29, Thorsten Kiefer <toki...@xxxxxxxxxxxxxxxx> wrote:
phantas...@xxxxxxxxxx wrote:
Hi,

I have a list like this: [[[a,b],[b,c]],[[c,d],[d,v]]] where the
number of elements (sublists) is two but number of elements inside
sublist can be random.
I want a list like this: [[a,b,c], [c,d,v]] (in this case)

I have considered union/3 predicate but I don't know how I can iterate
on every member of the list.
Any help?

thanks

Maybe like that :

map(_,[],[]).
map(F,[X|XS],[Y|YS]) :- apply(F,[X,Y]),map(F,XS,YS).

Regards
Thorsten

thanks thorsten i will try

.