Guest User

Untitled

a guest
May 20th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. (defun gray (a b c d)
  2. (setf res ())
  3. (if (= a 1)
  4. (setf res (append res '(1)))
  5. (setf res (append res '(0))))
  6. (if (or (and (eq a 0) (eq b 1)) (and (eq a 1) (eq b 0)))
  7. (setf res (append res '(1)))
  8. (setf res (append res '(0))))
  9. (if (or (and (eq b 0) (eq c 1)) (and (eq b 1) (eq c 0)))
  10. (setf res (append res '(1)))
  11. (setf res (append res '(0))))
  12. (if (or (and (eq c 0) (eq d 1)) (and (eq c 1) (eq d 0)))
  13. (setf res (append res '(1)))
  14. (setf res (append res '(0))))
  15. (mapcar (lambda (x) (format t "~A" x)) res)
  16. )
  17.  
  18. (setf a (read))
  19. (gray (mod (/ a 1000) 10) (mod (/ a 100) 10) (mod (/ a 10) 10) (mod a 10) )
Add Comment
Please, Sign In to add comment