On Thu, Nov 5, 2009 at 7:48 PM, Don <[email protected]> wrote:
> I'm having problems with a recursive call I make. The problem (as far
> as I gather) is that I have two recursive calls within a condition and
> I'm not sure if the second recursive call is being made.
>
It is, but some results are being discarded.
> (do
> (let [rslt1 (dp (subvec crds1 0 (+ index 2)) eps)
> rslt2 (dp (subvec crds1 index end) eps)]
> (let [rslt (into (subvec rslt1 0 (- (count rslt1) 2))
> (subvec rslt2 0 (count rslt2)))]
> rslt)))
>
Change that to this:
(let [rslt1 (dp (subvec crds1 0 (+ index 2)) eps)
rslt2 (dp (subvec crds1 index end) eps)]
(into (subvec rslt1 0 (- (count rslt1) 2))
(subvec rslt2 0 (count rslt2)))))
Clojure's "let" doesn't work like in an imperative language.
Instead of
let x = this
let y = foo(x)
return quux(y)
you have
(let [x this
y (foo x)]
(quux y))
that is, you put the code that uses the things you're letting inside of the
let's parentheses, but after the vector with the bindings.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---