繁体   English   中英

从头到尾不起作用,就像我期望的那样

[英]from-end does not work as I expect in position

[18]> (position 3 '(1 2 3 4 5 6 7 8) :from-end nil)
2
[19]> (position 3 '(1 2 3 4 5 6 7 8) :from-end t)
2

该怎么办?

position如记录在案。 超标说

返回的位置是满足测试的最左边(如果从结尾为真)或最右边(如果从结尾为假)元素的序列中的索引; 否则返回nil。 无论start,end还是from-end的值,返回的索引都是相对于整个序列的左端

尝试(position 3 '(1 2 3 4 3 2 1) :from-end t)看看:from-end关键字实际上是做什么的......

你想要的更简单 - (- (length list) (position elem list))

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM