乐筑天下

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

[编程交流] cond() - why ((t nill)) is com

[复制链接]

218

主题

699

帖子

483

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1090
发表于 2022-7-5 18:29:44 | 显示全部楼层 |阅读模式
hi
 
  1. (cond  ((= s "Y") 1)   ((= s "y") 1)   ((= s "N") 0)   ((= s "n") 0)   (t nil))
 
usually functions return nill when an empty value is issue, in cond returning nill is exposed to the developer...why?
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 18:34:52 | 显示全部楼层
With / without is the same return (nil).
回复

使用道具 举报

218

主题

699

帖子

483

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1090
发表于 2022-7-5 18:39:27 | 显示全部楼层
So why its a common way?(according to docs)
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 18:45:21 | 显示全部楼层
I think it is just an example to beginners to know the use of t symbol with cond function and nothing's more.
回复

使用道具 举报

218

主题

699

帖子

483

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1090
发表于 2022-7-5 18:49:25 | 显示全部楼层
Is there any use of t byond the self explained true?
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 18:51:26 | 显示全部楼层
As far as I know , no.
 
The use of t at the end of cond function is to pass any value you want if the arguments that passed to the function are not to equal to any value.
回复

使用道具 举报

218

主题

699

帖子

483

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1090
发表于 2022-7-5 18:55:49 | 显示全部楼层
Not sure what u mean...
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 18:58:48 | 显示全部楼层
Do you know what is the use of symbol t at the end of cond function?
回复

使用道具 举报

218

主题

699

帖子

483

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1090
发表于 2022-7-5 19:03:44 | 显示全部楼层
As i understand....if t equal to t...than return nill
回复

使用道具 举报

218

主题

699

帖子

483

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1090
发表于 2022-7-5 19:09:08 | 显示全部楼层
Or maybe its a defult if none is true. But why?
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-12 19:30 , Processed in 0.557672 second(s), 72 queries .

© 2020-2025 乐筑天下

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