:distinct-on helper fn; fixes #1