Why am i getting this error:
The value (2 (2 (2 (2 (2) 2) 2) 2) 2) is not of type NUMBER when binding SB-KERNEL::X [Condition of type TYPE-ERROR]
when calling the subst-if with the follwoing test function:
(defun 2p (N) (= N 2))
(subst-if 3 #'2p '(2 (2 (2 (2 (2) 2) 2) 2) 2))
You have to use
equaloreql(or any function that can compare arbitrary values, for your caseeqlbeing faster) in the2pfunction, as the function has to be able to receive any value inside the argument you're passing (the list with sublists). The=function is meant for numbers.The definition for
=: