Given 2 lists, I want to ensure that they are the same size, I'm having a tough time with this code. Should I be using variables to do this?
(defun samesize (list1 list2)
(cond (;logic here) T))
Both Common Lisp and elisp have length
:
(defun samesize (list1 list2)
(= (length list1) (length list2)))
You can use recursion if you want to implemet this yourself.
2 lists are the same size if they are both empty. They are different size if one is empty and the other is not. And if none of these is true, they are of the same size-comparison as those lists sans one element (i.e. their cdr
-s)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With