To me apply is one of the more difficult functions in Clojure. I'm looking for a good definition of its mechanics - what exactly it does, especially regarding how it 'grabs' arguments that it feeds to the function it is supplied as the first parameter. For instance this definition:
apply explodes a seqable data structure so it can be passed to a function that expects a rest parameter. For example, max takes any number of arguments and returns the greatest of all the arguments.
, from the 'Brave and True' book. Is there more to it than that? It seems to me that apply can be given many 'free' arguments (arguments not in any data structure) and will supply them to the given function. What are the rules for how apply grabs params for its function? What makes it stop?