# Equating two lists, element by element

Say you have two lists:

listA = {a, b, c}

listB = {d, e, f}

How would you produce a listC that equates each of the two's elements, ie.

listC = {a == d, b == e, c == f} ?

I know, it's very easy, but somehow I've already spent an slightly embarrassing amount of time on this. I suspect it will involve Map, but can't seem to get the elements to behave together per each element. It seems to just Append the two together for some reason.

SetAttributes[listA, Listable] SetAttributes[listB, Listable]

seems promising given this: http://reference.wolfram.com/mathematica/ref/Listable.html

-
Thread[listA == listB] – R. M. Jun 12 '13 at 0:45
@rm -rf thank you – Ghersic Jun 12 '13 at 0:47
Can you answer your own question now, using rm's hint? – J. M. Jun 12 '13 at 2:22
@rm-rf If listA is equal to listB, then Thread[listA == listB] will return just True. In that case, this: MapThread[Equal, {listA, listB}]. – Michael E2 Jun 12 '13 at 5:37
– István Zachar Jun 12 '13 at 7:43

As @rm -rf mentioned in the comments,

Thread[listA == listB]

accomplishes what I'd hoped. Apoogies for missing this.

As Michael notes, if they are already equal to these values (you're not newly naming listA or listB) and they happen to already be equal , the query just returns "true." If this is the case, use:

MapThread[Equal, {listA, listB}]

as mentioned by MichaelE2 in the comments.

-