Timeline for Occurrences (frequency count) - exercise 3 ch. 3 in "ansi common lisp"
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 25, 2019 at 18:10 | comment | added | Renzo | Thanks, @davypough, very interesting comments! | |
Mar 25, 2019 at 18:06 | comment | added | davypough |
3) You can generalize the alist solution to accept any sequence of objects as input by using the :iterate library, which allows a driver like (for x in-sequence lst) .
|
|
Mar 25, 2019 at 18:06 | comment | added | davypough |
Nice comparison of alist & hashing approaches. Also of note: 1) Although the original problem only requires eql elements, alists automatically allow any lisp object as key, whereas hashing requires a priori specification of the key test (worst case equalp ); 2) In line with not being shy about modifying primitives, the alist approach might be simplified and speeded up by incrementally constructing and destructively modifying the resulting alist by using something like (let ((pair (assoc x alist))) (if pair (rplacd pair (incf (cdr pair))) (push (cons x 1) alist)) ;
|
|
Mar 21, 2019 at 13:44 | history | edited | Renzo | CC BY-SA 4.0 |
added 63 characters in body
|
Mar 18, 2019 at 18:24 | history | edited | Renzo | CC BY-SA 4.0 |
deleted 1 character in body
|
Mar 18, 2019 at 16:53 | history | edited | Renzo | CC BY-SA 4.0 |
added 446 characters in body
|
Mar 18, 2019 at 16:45 | history | answered | Renzo | CC BY-SA 4.0 |