Image missing.
Solving a wooden puzzle using Haskell

created: Sept. 17, 2025, 5:22 a.m. | updated: Sept. 21, 2025, 1:38 a.m.

The linear library provides the V3 type constructor for vectors of three coordinates; the type of positions will thus be V3 Int . dispositionCoordinates :: Disposition -> [ V3 Int ] dispositionCoordinates disposition = fmap applyTransform genericPiece where -- Note that we are applying the translation after the rotation. applyTransform :: V3 Int -> V3 Int applyTransform vector = translation disposition + (rotation disposition ! The Disposition datatype is infinite (ignoring technicalities): it has fields of type V3 Int and M33 Int , which both have Int coefficients, and Int is infinite. So we'll convert it all to coordinates:allValidPieces :: [[ V3 Int ]] allValidPieces = fmap dispositionCoordinates allValidDispositionsPhew!

1 month ago: Hacker News