RosettaCodeData/Task/Faces-from-a-mesh/J/faces-from-a-mesh.j
2023-07-01 13:44:08 -04:00

12 lines
270 B
Text

edge_to_node=: 3 :0
assert. 2 = #/.~ , y [ 'expect each node to appear twice'
oel=. 1 2 {. y
Y=. }. y
while. # Y do.
i =. <. -: 1 i.~ , Y (e."1) {: oel
assert. 0 < # i [ 'isolated edge detected'
oel =. oel , i { Y
Y =. i ({. , (}.~ >:)~) Y
end.
~. , oel
)