Adapted to using list comprehension

Don't merge until the next OpenSCAD release.
This is an idea for how to simplify this script by using the new list comprehension functionality in OpenSCAD, currently close to being finalized: https://github.com/openscad/openscad/pull/792

It can likely be simplified further by digging deeper.