3 ms·
My naive looked more like: (with apologies on likely messing up spacing in hn.) (let ((in '((1 "one") (1 "two") (1 "three") (1 "one") (1 "four") (1 "two"))
by taeric 3y ago
My naive looked more like: (with apologies on likely messing up spacing in hn.)
(let ((in '((1 "one") (1 "two") (1 "three") (1 "one") (1 "four") (1 "two"))))
(loop with hash = (make-hash-table :test #'equal)
for v in in
do (incf (gethash (cadr v) hash 0))
finally (return (loop for key being the hash-keys of hash
collect (list (gethash key hash) key)))))