Isoraqathedh

So much repetition

Feb 21st, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.45 KB | None | 0 0
  1. (defun rook-limited (length directions)
  2.        (concatenate 'list
  3.             (when (member 'forward directions)  (loop for i from  1     to    length  collect `( 0 . ,i)))
  4.             (when (member 'backward directions) (loop for i from -1 downto (- length) collect `( 0 . ,i)))
  5.             (when (member 'left directions)     (loop for i from -1 downto (- length) collect `(,i .  0)))
  6.             (when (member 'right directions)    (loop for i from  1     to    length  collect `(,i .  0)))))
Advertisement
Add Comment
Please, Sign In to add comment