明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: 小万LISP

[经验] 终于搞清楚cond用法了

[复制链接]
发表于 2019-9-30 19:03:15 | 显示全部楼层
You can use list in this case :
  1. (while
  2.   (not
  3.     (setq h
  4.       (cdr
  5.         (assoc
  6.           (getint "\nPlease enter the numeric number: ")
  7.           '((1 . 250)(2 . 550)(3 . -370)(4 . -740))
  8.         )
  9.       )
  10.     )
  11.   )
  12.   (print "Requires an integer between 1 and 4.")
  13. )
回复 支持 1 反对 0

使用道具 举报

发表于 2019-10-5 16:43:30 | 显示全部楼层
评估一下需要cond来测试的几个条件,把出现频率高的写在前面,频率低的写在后面,这样可以节省运行时间
发表于 2019-10-6 09:20:11 | 显示全部楼层
你说的葵花宝典在哪里?
发表于 2019-10-6 09:22:07 | 显示全部楼层
ketxu 发表于 2019-9-30 19:03
You can use list in this case :

Are you foreigner?

点评

yes , he is .  发表于 2019-10-6 09:56
发表于 2019-10-6 10:24:11 | 显示全部楼层

牛逼!我还以为我喜欢去看国外的论坛,还是有外国人看我们论坛!
发表于 2019-10-8 15:32:05 | 显示全部楼层

Yeah, i am Vietnamese. Sorry for my bad language
发表于 2019-10-8 17:34:17 | 显示全部楼层
(VL-FILENAME-DIRECTORY (cond((FINDFILE "TT.vlx"))("")))
也可以这样用,防止FINDFILE返回NIL导致代码出错,可以COND返回""空字符。这样就不会出错
发表于 2019-10-13 11:46:05 | 显示全部楼层
ketxu 发表于 2019-10-8 15:32
Yeah, i am Vietnamese. Sorry for my bad language

lisp is beyond boundries ! Welcome to the forum!
发表于 2019-10-14 20:11:07 | 显示全部楼层
谢谢分享,支持
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-18 16:08 , Processed in 0.189426 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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