------------
The author confuses "apply" and "reduce" (aka "fold").
- `apply` calls a function once, passing it all the specified args. It is very similar to `funcall`, except the last argument of `apply` is a list of args.
- `reduce` repeatedly calls a function on an accumulator and each element of a list.
Examples:
(vector 1 2 3 4)
=> [1 2 3 4]
(funcall 'vector 1 2 3 4)
=> [1 2 3 4]
(apply 'vector 1 2 (list 3 4))
=> [1 2 3 4]
(seq-reduce 'vector (list 1 2 3 4) 0)
=> [[[[0 1] 2] 3] 4]
The author's confusion is probably because `+` in Lisp is variadic, so `(apply '+ nums)` and `(seq-reduce '+ nums 0)` happen to produce the same result.------------
Also, the way the author's implementation guesses the initial value is awful. The standard practice is to either ask the caller to explicitly provide the initial value (which is what `seq-reduce` does), or to use the first element of the list as the initial value.
(The latter has the advantage of being simpler to use, since the programmer doesn't need to find the correct identity element that needs to be passed as the initial value (e.g. for + the identity is 0, but for * the identity is 1). The disadvantage is that it fails on empty lists. Also, in statically-typed languages it can only supports binary operators, so it is not as powerful as the version that takes an explicit initial value.)