乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 88|回复: 8

[编程交流] (defun cb:...)

[复制链接]

3

主题

3

帖子

0

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 14:25:10 | 显示全部楼层 |阅读模式
hello
 
i'm starting with autocad lisp
 
i've learnd that you start a routine with
 
(defun c:name ....)
 
 
but now i've found a program that start with
 
(defun cb:hdis (/ld)
 
this comes back with the variables
 
if (= (type cb:ld) 'str
 
i understand the meanig of this code exept what te cb: means
 
can someone tell me what's the difference between defun c: and defun cb:
回复

使用道具 举报

VVA

1

主题

308

帖子

308

银币

初来乍到

Rank: 1

铜币
8
发表于 2022-7-6 14:37:21 | 显示全部楼层
By analogy to this article, I have written article on use of a code from a forum in Russian, where has a little expanded the description.
As I not so well know English, therefore I will take advantage of machine translation. I hope, it will be clear, and if is not present, me will correct.
 
 
In your case it is function and it needs to be caused so: (cb:hdis)
回复

使用道具 举报

12

主题

395

帖子

384

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
60
发表于 2022-7-6 14:44:45 | 显示全部楼层
I believe I've seen that lisp before. "cb:" doesnt actually do anything. That code is just a function. if you were to type in "hdis" as a command it wouldnt do anything. but if you were to use it like this (cb:hdis) it would run. Why they named it that way is unknown to me but im sure they had their reasons.
回复

使用道具 举报

12

主题

395

帖子

384

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
60
发表于 2022-7-6 14:54:10 | 显示全部楼层
Too little too late it seems. Good description VVA
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 14:56:14 | 显示全部楼层
Nice once VVA, but, yes, I believe its just irresponsible function naming...
回复

使用道具 举报

24

主题

1265

帖子

1028

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
362
发表于 2022-7-6 15:09:45 | 显示全部楼层
 
I wouldn't bet on it... I do this all the time. Useful for identification.
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-6 15:14:01 | 显示全部楼层
 
 
I agree.  I use function name prefixes all of the time.  My preference is to use an underscore delimiter , but a colon is just as valid.  My $0.02  -David
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:20:03 | 显示全部楼层
 
You mean using the function syntax as a prefix for sub_routines - I suppose its good for reference, but the function begins with a c..: I suppose it could confuse the LISP novice...
回复

使用道具 举报

24

主题

1265

帖子

1028

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
362
发表于 2022-7-6 15:32:32 | 显示全部楼层
Possibly, but still nothing wrong with it. I do this sometimes within the same file. Say my file (and main function is named) CHTXT - i might name my internal functions things like:
  1. (defun chtxt:myfunc ()  (blah_blah))
Of course, like David says, just my 2¢.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-5 01:10 , Processed in 0.326676 second(s), 70 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表