Naive A* implementation in Scheme