The enclosed vector (or list, map, set, etc) is considered as arg1 because it is one entity. Take a look at the source for subvec:
=> (clojure.repl/source subvec) (defn subvec "Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done." {:added "1.0"} ([v start] (subvec v start (count v))) ([v start end] (. clojure.lang.RT (subvec v start end)))) nil Notice that it takes 2 or 3 arguments. Your example, (subvec [1 2 3 4 5] 1 3), correspond with the 3 args method. You can verify this by: => (count '([1 2 3 4 5] 1 3)) 3 So the correct definition for something like subvec is (function [vector_arg1 arg2 arg3] body). For more info on how to play with the function arguments, look into 'clojure destructuring'. On Jun 15, 11:31 am, James Keats <james.w.ke...@gmail.com> wrote: > Hi again. This is another syntax that I'm struggling with: > > (function [args] more args) > > Or for example: > > (subvec [1 2 3 4 5] 1 3) > > Please note I'm not referring specifically to the subvec function, but > simply using it as an example, as I've seen this syntax with many > other functions, but it escapes my mind now to provide more examples. > > I don't like it, and here's what I don't like about it. It leaves me > with a bad taste that where the arguments are generally meant to be > passed to the function in a vector of arguments, some are sometimes > passed outside the vector. It feels inconsistent and ad hoc. > > What am I missing out on? are the arguments contained within a vector > only when defining functions? such as: > > (defn name [args] > body) > > Thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en