Return to Snippet

Revision: 25059
at March 18, 2010 16:15 by deepsoul


Initial Code
rect :: Int -> Int -> [[(Int,Int)]]
rect a b = map (pam $ map (,) [1..a]) [1..b]

box :: Int -> Int -> Int -> [[[(Int,Int,Int)]]]
box a b c = map (pam . map pam $ map (pam $ map (,,) [1..a]) [1..b]) [1..c]

Initial URL

                                

Initial Description
These functions return all points (pairs or triples of coordinates) within a given rectangle or box.  ``pam`` is the reverse map function which was defined [here](http://snipplr.com/view/18351/reverse-map/).

Initial Title
Interval of integral points

Initial Tags

                                

Initial Language
Haskell