gpt4 book ai didi

lisp - 确保 lisp 中的 2 个列表长度相同的最简单方法是什么?

转载 作者:太空宇宙 更新时间:2023-11-03 18:34:59 25 4
gpt4 key购买 nike

给定 2 个列表,我想确保它们的大小相同,我很难处理这段代码。我应该使用变量来执行此操作吗?

(defun samesize (list1 list2)
(cond (;logic here) T))

最佳答案

两者都是Common Lispelisp长度:

(defun samesize (list1 list2)
(= (length list1) (length list2)))

关于lisp - 确保 lisp 中的 2 个列表长度相同的最简单方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4029464/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com