I can get the first element of every tuple if I create the list at the same time, for example
[element(2,X) || X <- [{1,2},{3,4}]].
[2,4]
This works as it should. I want to be able to create the list before I try to do anything with it
Ex: Create the list
X = [{1,2,3},{3,4,5}].
[{1,2,3},{3,4,5}]
Then get the first element of each tuple
element(1,X).
But I get the error
** exception error: bad argument
in function element/2
called as element(1,[{1,2,3},{3,4,5}])
I want this code to give the same results that my first example gave