The Global Positioning System exercise

I’ve just added the Global Positioning System exercise. This exercise is designed to be a good starting point to begin working with Definite Clause Grammar (DCG) support in Prolog. I love DCG, so I hope this exercise will get you all enthusiastic too!

3 Likes

Awesome :slight_smile: Excited for Prolog!

Hi,

Prolog is great fun, and also this new exercise! However, solving it I noticed some details I would like you to double-check.

The instructions for the coordinate format includes a comma between latitude and longitude parts, but the example a couple of lines below does not.

Also, the test case “coordinate_parses_coordinate” checks for an example without comma and expects a fail. The test will of course pass when the implemented DCG rule checks for a comma.

It seems like the test case passes for the wrong reason (fail when using an incorrect value), but internally it checks for each numeric value and hemisphere to be correctly parsed. Shouldn’t it be changed (or another test case added) to check with correctly formatted coordinate value?

You are 100% correct! Thanks for the heads-up. Will be fixed in global-positioning-system: fix tests and instructions by ErikSchierboom · Pull Request #449 · exercism/prolog · GitHub

2 Likes