[ create a new paste ] login | about

Link: http://codepad.org/NPuYCW1H    [ raw code | fork ]

Plain Text, pasted on Apr 22:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(defun update-score (old-score new-value)
  (mod (+ old-score new-value)))

(defun score (data)
  (let* ((n (length data))
         (v (make-array (1+ n))))
    ;; Store the data in V
    (replace v data)
    ;; Store the initial score 0
    (setf (aref v n) 0)
    ;; Update the score for all elements of DATA.
    (loop :for x :across data :do
      (setf (aref v n) (update-score (aref v n) x)))
    ;; Return V.
    v))


Create a new paste based on this one


Comments: