I know I'll only have assoc lists of the form
Code Select
((a (1 2)) (b (3 4)) ...)
I want to write a function like
Code Select
(push-assoc key value assoc-lst)
The only way I could get it to work is if I instead had a global assoc-lst that I used.
Code Select
(set 'alst '())
(define (push-assoc k v )
(if (lookup k alst)
(assoc-set (alst k) (list k (append (last $0) (list v))))
(push (list k (list v)) alst -1)))
Any suggestions on how to make this so I can pass in the assoc-lst ?
I tried using a define-macro but failed.
I think I'm just missing something obvious.