# Mapping list elements without using Table function

How could I generate the following list of points using some function or mapping without using the table function.

x = (1 - Cos[# Pi])/2 & /@ Range[0, 1, 0.1];
y = (1 - Cos[# Pi])/2 & /@ Range[0, 1, 0.1];

nx = Length[x];
ny = Length[y];

nodesElement =
Flatten[Table[{{x[[i]], y[[j]]}, {x[[i + 1]], y[[j]]}, {x[[i + 1]],
y[[j + 1]]}, {x[[i]], y[[j + 1]]}}, {j, 1, ny - 1}, {i, 1,
nx - 1}], 1];


I am interested in more pure functional programming

• One way: Flatten[Outer[{y, x} |-> {{x[], y[]}, {x[], y[]}, {x[], y[]}, {x[], y[]}}, Partition[y, 2, 1], Partition[x, 2, 1], 1], 1] – thorimur Jun 24 at 18:47
• if you instead wanted a different order of the points you could maybe use Tuples instead of a custom function—or maybe there's a slicker way I'm not thinking of! – thorimur Jun 24 at 18:51
• Is the order of your element important? – bRost03 Jun 24 at 19:08
• No. The order of the elements is not important – Jose Nuñez Jun 24 at 19:13

How about this one: Tuples /@ Tuples[Partition[x, 2, 1], 2]

Or in the case $$x\neq y$$: Tuples /@ Tuples[{Partition[x, 2, 1], Partition[y, 2, 1]}]

Note that this gives the same thing as

Flatten[Table[{{x[[i]], y[[j]]}, {x[[i]], y[[j+1]]}, {x[[i+1]],
y[[j]]}, {x[[i+1]], y[[j+1]]}}, {i, 1, ny - 1}, {j, 1, nx - 1}], 1]


Which is just a reordering of what you posted.

xv = Indexed[x, #] & /@ Range