 - (defun c:tt ()
- (setq lst '("12*2" "2*10" "10*11" "5.5*5"))
- (setq lst(mapcar '(lambda(x)
- (list
- (substr x 1(vl-string-search "*" x))
- (substr x(+ 2(vl-string-search "*" x)))
- )
- )
- lst)
- )
- (setq newlst nil)
- (foreach x lst
- (repeat(atoi(cadr x))
- (setq newlst(cons(atof(car x))newlst))
- )
- )
- (setq newlst(reverse newlst))
- (print newlst)
- (princ)
- )
好吧,稍微研究了一下,写成这样,倒也达到效果了。还有更简洁的吗
|