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
So let me see if I can help out with this. In classic lisp, when you
define a function it would take this syntax:
(defn name (arg1 arg2)
body)
The only problem with this approach is that sometimes it is hard to
figure out what is part of the body and what is the argument lists.
Clojure
Hi,
in your example the vector *is* the argument. You could just as well write
(let [x [1 2 3 4 5]] (subvec x 1 3)).
On function definition the arguments are given in a vector, yes.
I'm not sure I understand your concern completely.
Sincerely
Meikel
--
You received this message because you
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
Hi, I admit that subvec is not a good example as it does indeed take a
vector as a first argument, perhaps i'll find better example or
perhaps I might've just been confused. I learnt lisp and scheme many
years ago, abandoned them for languages with better libraries, and I'm
perhaps thrown off by