Hey,
I have a struct. To make it simple, lets assume this is the struct:
(defstruct package name deps)
The deps slot is for the package dependencies. Example of packages:
(make-package :name "one" :deps "two")
(make-package :name "two" :deps '("three" "four"))
To make it easier to use the dependencies from the code, when I call (package-deps package) I always want it to return a list. So:
(let ((one (make-package :name "one" :deps "two"))
(two (make-package :name "two" :deps '("three" "four"))))
(print (package-deps one)) ;; => ("two")
(print (package-deps two)) ;; => ("three" "four")
)
I tried doing this using an advice, with no success:
(defadvice package-deps (around package-deps-around)
(let ((deps ad-do-it))
(if (listp deps) deps (list deps))))
(ad-activate 'package-deps)
Can I do this in a way that doesn't require that much of a hack?
Thanks!