明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1531|回复: 5

[求助]请高手指点一下

[复制链接]
发表于 2006-12-16 12:12 | 显示全部楼层 |阅读模式

用求交点程序得到下面这个点表,赋值给变量a

((7374.49 697.953 0.0) (15009.6 697.953 0.0) (7374.49 697.953 0.0) (15009.6
697.953 0.0))

为什么 (eq (nth 0 a) (nth 2 a)) 执行的结果为nil呢?

请高手指导一下,万分感谢!

 楼主| 发表于 2006-12-16 13:46 | 显示全部楼层
发表于 2006-12-16 18:47 | 显示全部楼层
结果不相等,EQ函数当然返回nil。
发表于 2006-12-16 21:42 | 显示全部楼层

下面是有关eq的定义 :

Determines whether two expressions are identical

(eq expr1 expr2) 

The eq function determines whether expr1 and expr2 are bound to the same object (by setq, for example).

Examples

Given the following assignments:

(setq f1 '(a b c)) 
(setq f2 '(a b c)) 
(setq f3 f2)

Compare f1 and f3:

Command: (eq f1 f3)

nil

eq returns nil because f1 and f3, while containing the same value, do not refer to the same list.

Compare f3 and f2:

Command: (eq f3 f2)

T

eq returns T because f3 and f2 refer to the same list.

发表于 2006-12-16 22:36 | 显示全部楼层

为什么不用equal!

 楼主| 发表于 2006-12-18 21:17 | 显示全部楼层
谢谢楼上,equal好用!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-11 16:15 , Processed in 0.145624 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表