Distance measures draft

Hi,

I've written some distance metrics but in js, without closure. I tried to port it but got TypeErrors didn't have much time to fix them.

I'd like to send this pull request, if you want, you or any volunteer can use/port my code.

There are two files, one without closure and one with closure (tried at least).