Solution (source code)

= Solution

First include the closing <edge> exactly once:
``
edges :: Polygon -> [(Point,Point)]
edges [] = []
edges ps = zip ps (tail ps ++ [head ps])

perimeter :: Polygon -> Double
perimeter = total . edges
  where total [] = 0
        total ((p,q):es) = distBetween p q + total es

perimeterFold :: Polygon -> Double
perimeterFold = foldr (\(p,q) s -> distBetween p q + s) 0 . edges
``
The recursive version and <right fold> both sum the <Euclidean distances> between consecutive <vertices>, including the last-to-first pair. They take <linear time>. The empty-list convention gives zero, although an empty list is not a valid <polygon>.