简体   繁体   English

方案列表等价比较

[英]scheme list equivalence comparison

Hello I need to check if two lists have same elements in same order but I wasn't able to achieve as it seems like scheme eq?您好,我需要检查两个列表是否具有相同顺序的相同元素,但我无法实现,因为它看起来像方案 eq? and eqv?和 eqv? checks by reference so giving false to such:通过引用检查,因此对此类错误:

> (eq? (list 1 2 3) (list 1 2 3))
#f
> (eqv? (list 1 2 3) (list 1 2 3))
#f

How to achieve this ?如何实现这一目标?

This site explains the difference between those operators.站点解释了这些运营商之间的区别。 But essentially, you want to use equal?但本质上,你想使用equal? when you want to compare the contents of two objects.当您想比较两个对象的内容时。

seems like equal?好像平等? and eq?和等式? are seperate procedures where equal checks as I needed:是单独的程序,根据我的需要进行同等检查:

> (equal? (list 1 2 3) (list 1 2 3))
#t

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

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