lambdabot

Untitled

Feb 18th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.39 KB | None | 0 0
  1.  (defun read-list ()
  2.   "Read-listV2"
  3.   (let ((n (read *standard-input* nil)))
  4.     (if (null n) nil
  5.     (cons n (read-list)))))
  6.  
  7. (defun dot-product (a b)
  8.   "Compute the mathematical dot product of two vectors."
  9.   (apply #'+ (mapcar #'* a b)))
  10.  
  11. (defun solver ()
  12.   (let ((input (read-list)
  13.       (a (dot-product (first input) (second input)))
  14.       (b (last input)))
  15.     (format t "~a" (mod a b)))))
Advertisement
Add Comment
Please, Sign In to add comment