I have a number of "alists".
(defconst assoc-table-1
'( ("frantic" . "fN") ("authentic" . "atN") ))
(defconst assoc-table-2
'( ("graphology" . "Gol") ("phrenology" . "fnol") ))
I then construct a "list of alists".
(defun assoc-list ()
"TODO"
(let* ( (name "assoc-table-")
(counter 1)
(table '()) )
(while (boundp (intern (concat name (number-to-string counter))))
(setq table
(append table
(symbol-value (intern (concat name (number-to-string counter))))))
(message "%s" (concat name (number-to-string counter)))
(setq counter (1+ counter)))
table))
which I pass to this function
(defun shorten ()
"Shorten word at point according to specific rules."
(interactive)
(let* ( (bounds (bounds-of-thing-at-point 'word))
(word (downcase (buffer-substring (car bounds) (cdr bounds))))
(rplc "") )
(goto-char (car bounds))
(add-to-list 'nscrip word)
(dolist (aggr (assoc-list))
(setq rplc (cdr (assoc word aggr)))
(unless (null rplc)
(add-to-list 'nscrip
(replace-regexp-in-string word rplc word))))
Thu function above fails on the first element because assoc-list
consists of a "list of alists"
, but (assoc word aggr)
expects a list in aggr
, but is getting an element with a dot in it.
How can I solve the problem encountered by (assoc word aggr)
.
BODY
; yourdolist
parentheses are not even closed. A minimal example would probably help.(assoc word aggr)
part that generates the problem.(setq rplc (cdr (assoc 'word aggr)))
in your second line. Note the apostrophe before word. As Gilles says you should provide a complete example with all your variables and lists declared