In article <··········@hippo.shef.ac.uk> ·········@shef.ac.uk (A.G.Gregg) writes:
--> Hi. Thanks for dropping in. Here is my problem....
-->
--> I have data constructed like this -
--> e.g.
--> (setf data '((a* (d d*) (n* d*) s*) (b (e* d* g*))) )
--> alphabetical as you can see
-->
--> I need one piece of code to read it with the stars, and one without.
--> The stars are just 'tags' on the node tree. What command or method can
--> I use to solve this without having two copies of the data, or totally
--> restucturing the data....?
-->
the cool way to do this is with a custom readtable that treats * as
whitespace and then you use the regular READ function.
(setq new-RT (copy-readtable))
(set-syntax-from-char #\* #\space new-rt)
(let ((*readtable* new-rt))
(declare (special *readtable*))
(setq aaa (read-from-string "((a* (d d*) (n* d*) s*) (b (e* d* g*)))"))
(print aaa))
be sure to get the args order right for set-syntax...I had them
backwards and crashed-n-burned...
-- clint