Subject: Re: Q 4 LISP GURUs: EED retreival Date: Sat, 01 Feb 1997 00:00:00 GMT From: vnestr@netvision.net.il (Vladimir Nesterovsky) Organization: IDAN Computers Newsgroups: comp.cad.autocad Morten -- Thanks again for the idea. The function may be refined a little though -- to get rid of EVAL and enclose strings in extra quotes to work properly. As usual you'll see here the regular MAPCAR that saves us a lot of SETQs. We only need READ here (again, great idea!) : (defun rebuild-list( xlst ) (read(apply'strcat(mapcar'(lambda(v) ;; your code refined a little: (cond ((= v "{") "(") ((= v "}") ")") ((= (type v) 'INT) (strcat (itoa v) " ")) ((= (type v) 'REAL) (strcat (rtos v 2 20) " ")) ((= (type v) 'STR) (strcat "\"" v "\"")) (T "") )) xlst)))) Chao - On Fri, 31 Jan 1997 14:20:38 +0100, - Morten Warankov wrote in comp.cad.autocad: > Hi Vladimir, > You asked for an easy solution, well, I never give up in trying to give > you the solution you want. :) > What do you think of this 4 lines function ? Still not what you want? > ________________________________________________ > (defun cl ( a / a1) > (setq a1 "") > (foreach i a (setq a1 (strcat a1 (chb i)))) > (setq a (eval (read a1)))) > ;; a little helping function > ;; add more cond's if you need > (defun chb (l / ) > (cond ((= l "{") (setq l "(list ")) > ((= l "}") (setq l ") ")) > ((= (type l) 'INT) (setq l (strcat (itoa l) " "))) > ((= (type l) 'REAL) (setq l (strcat (rtos l) " "))) > ((= (type l) 'STR) (setq l (strcat l " "))) > (T (alert (strcat "Unknown type of data: " l))) > ) > l > ) -- Vladimir Nesterovsky ADS/LISP/C/C++ etc IDAN Computers Ltd.