表问题
请教下大家,如何将表("我“ "1" "chana" "2" "3")
转成
("我“ 1 "chana" 2 3)
注意:
1、中文与英文的位置可能不一样
2、表内元素可能也不止这几个
(mapcar '(lambda(x)(if(=(rtos(atof x)2)x)(atof x)x))'("我" "1" "chana" "2" "3")) (mapcar '(lambda(x) (if (numberp(distof x)) (distof x) x)) '("我" "1""chana""2""3")) 自贡黄明儒 发表于 2022-8-2 15:13
(mapcar '(lambda(x) (if (numberp(distof x)) (distof x) x)) '("我" "1""chana""2""3"))
谢谢{:1_1:} 晨曦CAD 发表于 2022-8-2 15:11
(mapcar '(lambda(x)(if(=(rtos(atof x)2)x)(atof x)x))'("我" "1" "chana" "2" "3"))
谢谢{:1_1:} distof比atof适用性更广
比如
(distof "8/2")==> 4.0
(atof "8/2")==> 8.0
(mapcar'(lambda(x / a)(if(setq a(distof x))a x))'("我""1""chana""2""3")) 也可以用read,
(read"3") ==> 3
(read "3.0") ==> 3.0 自贡黄明儒 发表于 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) read不行的
(type (read "我"))=>SYM
页:
[1]