明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1297|回复: 9

[提问] 表问题

[复制链接]
发表于 2022-8-2 14:40:45 | 显示全部楼层 |阅读模式
请教下大家,如何将表

("我“   "1"    "chana"      "2"    "3")
转成
("我“   1    "chana"      2    3)
注意:
1、中文与英文的位置可能不一样
2、表内元素可能也不止这几个
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2022-8-2 15:11:41 | 显示全部楼层
(mapcar '(lambda(x)(if(=(rtos(atof x)2)x)(atof x)x))  '("我"   "1"    "chana"      "2"    "3"))
发表于 2022-8-2 15:13:43 | 显示全部楼层
(mapcar '(lambda(x) (if (numberp(distof x)) (distof x) x)) '("我"   "1"  "chana"  "2"  "3"))
 楼主| 发表于 2022-8-2 18:15:12 | 显示全部楼层
自贡黄明儒 发表于 2022-8-2 15:13
(mapcar '(lambda(x) (if (numberp(distof x)) (distof x) x)) '("我"   "1"  "chana"  "2"  "3"))

谢谢
 楼主| 发表于 2022-8-2 19:57:41 | 显示全部楼层
晨曦CAD 发表于 2022-8-2 15:11
(mapcar '(lambda(x)(if(=(rtos(atof x)2)x)(atof x)x))  '("我"   "1"    "chana"      "2"    "3"))

谢谢
发表于 2022-8-2 20:22:04 | 显示全部楼层
distof比atof适用性更广
比如
(distof "8/2")  ==> 4.0
(atof "8/2")  ==> 8.0
发表于 2022-8-3 11:54:28 | 显示全部楼层
  1. (mapcar'(lambda(x / a)(if(setq a(distof x))a x))'("我""1""chana""2""3"))
发表于 2022-8-3 15:11:35 | 显示全部楼层
也可以用read  ,  
(read  "3") ==> 3
(read "3.0") ==> 3.0
发表于 2022-8-3 16:02:32 | 显示全部楼层
自贡黄明儒 发表于 2022-8-2 15:13
(mapcar '(lambda(x) (if (numberp(distof x)) (distof x) x)) '("我"   "1"  "chana"  "2"  "3"))

("我" 1.0 "chana" 2.0 3.0)
发表于 2022-8-16 10:27:44 | 显示全部楼层
read不行的
(type (read "我"))  =>  SYM
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-15 12:50 , Processed in 0.173066 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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