2012-04-23

Programing Problem: Decimalize Latitude Longitude

Last year, i ran a elisp exercise but i got busy and never gave answer. Let's do this again. Here's the problem

Write a function “latitude-longitude-decimalize”.

It should take a string like this: "37°26′36.42″N 06°15′14.28″W". The return value should be a pair of numbers, like this: [37.44345 -6.25396].

Feel free to use perl, python, ruby, etc. I'll be posting a solution in emacs lisp in 2 days.

If you got stuck, you might peak at Kurt Schwehr's solution in python, at Source schwehr.org.

Kurt's site is down at the moment. Here's a temp site for his python code: Source pastebin.com

update

• Jon Snader (jcs)'s solution in elisp + CL package, @ Source irreal.org

• Kurt's solution, Python, @ Source pastebin.com

• Mickey Petersen's solution, using emacs calc + elisp, @ Source www.masteringemacs.org

Jean-S├ębastien Ney, Ruby. Port of Kurt's python code to ruby, @ Source gist.github.com.

Jorge A. Alfaro Murillo solution in elisp, @ Source pastebin.com

• Ian Kelly. Python 3. @ Source groups.google.com

will write a blog collecting the solutions and summery, and my clunky elisp solution this weekend.