|
|
|
@ -27,7 +27,9 @@
|
|
|
|
|
(loop (+ loc (* new-dir dist)) new-dir (cdr turns))))))
|
|
|
|
|
(+ (abs (imag-part loc)) (abs (real-part loc))))
|
|
|
|
|
|
|
|
|
|
(define-macro-cases turn
|
|
|
|
|
[(turn "L" DIST) #'(cons +i (string->number DIST))]
|
|
|
|
|
[(turn "R" DIST) #'(cons -i (string->number DIST))])
|
|
|
|
|
(define-macro (turn DIR DIST)
|
|
|
|
|
(with-pattern ([NEW-DIR (syntax-case #'DIR ()
|
|
|
|
|
["L" #'+i]
|
|
|
|
|
["R" #'-i])])
|
|
|
|
|
#'(cons NEW-DIR (string->number DIST))))
|
|
|
|
|
(provide turn)
|