求助:一个小问题
<P>我写了一段小程序:(defun zidong()<BR> (setq x0 (getpoint "请输入起点坐标"))<BR> (setq n (getint "请输入段数"))<BR>(setq l0 '())<BR>(repeat n<BR> (setq i(getreal "请输入跨距"))<BR>(setq l0 (append l0 (list i))))<BR> (setq m0 1)<BR> (setq n0 1)<BR> (while (<= n0 n)<BR> (setq l (nth m0 l0)) :此句有错<BR> (setq x1 (list (+ (car x0) l) (cadr x0)))<BR> (setq x2 (list (+ (car x0) l) (-(cadr x0) 2.5)))<BR> (setq x5 (list (car x2) (-(cadr x2) 2)))<BR> (setq n0 (+ n0 1))<BR> (setq m0 (+ m0 1))<BR> (command "line" x0 x1 "")<BR> (command "line" x1 x2 "")<BR> (command "circle" x5 2)<BR> (setq x0 (list (car x1)(cadr x1)))<BR> ))</P><P>但是在nth那句有错,nth后面只能跟整数,可是我想从1---n的提取数据,该怎么办啊???</P>
<P>求大家帮助</P> <P>例如:(nth 1 (list 5 3 8 4))将得到3,位置从0开始,最后面是一个表.</P> <P>用上面的方法 再加上一个while循环就可以了</P>
页:
[1]