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