Dear CLIPS users and team!
Please, explain me how this function works.
(deffunction find-first (?x ?y)
(println ?x "," (nth$ 1 ?y) "," (eq ?x (nth$ 1 ?y)))
(if (= (length$ ?y) 0)
then FALSE
else if (eq ?x (nth$ 1 ?y))
then ?y
else
(find-first ?x (rest$ ?y))))
CLIPS> (find-first b (create$ a b c))
b,a,FALSE
b,b,TRUE
b,c,FALSE
b,nil,FALSE
FALSE
CLIPS>
From documentation:
"..The return value
of the if function is the value of the last <expression> or
<action> evaluated."
Sincerely,
Ru.