"If there is only one expression in the sublist (that is, if result is missing), the value of the test expression is returned."
So the way I read this statement is that if you only have one test situation in your sublist then it'll return the test result of the only one expression.
For example if your cond statement looks like this:
(cond (a))
And since a does not exists the test result of nil is returned.
When you add a 2nd item to the sublist:
(cond (a) (1))
Then when the test evaluation of the first item fails the test evaluation of the next item in the sublist is returned in this case it's the number 1 which has the value of 1.
Now if you set a to something like this:
(setq a "abc")
The cond statement this time returns the successful evaluation result of the first item of "abc".
Using the apply function with cond operates the same when written like this:
(apply 'cond '(a))
But I think the way the code is written for the apply function with cond only evaluates the first element. So when the first element in this case b fails then it just stops and returns nil.
(apply 'cond '(b a))
correction:
If you want to use the cond Instead of using cond function just use eval unction on an unknown length list of items I'm more comfortable with using forever function like this:
; setup sample
; variables with value = a & b
; varibles with nil = c & d
; list of a b c d = curlst
; list with nil = newlst
(setq a "abc" b "def" c nil d nil curlst (list a b c d) newlst nil)
; use foreach to loop through each item in the list and run cond function
(foreach itm curlst (setq newlst (append newlst (list (eval itm)))))
; returns newlst which gives you evaluation results on each item:
For curlst: (list a b c d)
Returns newlst: ("abc" "def" nil nil)
Now you can examine the list results & compare to the original list