A Simple Program

Given as input a list of sublists, each of which has the format (key n), sum the n for each key.

(alsum '((a 3) (b 2) (c 1) (a 5) (c 7)))

     =  ((C 8) (B 2) (A 8))

(defun alsum (lst)
(let ( (alist nil) entry)
=(dolist ( item (identity lst))
> =(setq entry
>> (or = (assoc (car item) alist)
>>> (progn = (push (list (car item) 0 ) alist)
>>>> (assoc (car item) alist))))
>> ( incf (cadr entry) (cadr item) ) )
> alist))

Different fonts are used for code associated with different abstract components. Clearly, code of the components is thoroughly mixed in this program.

Contents    Page-10    Prev    Next    Page+10    Index