Great! Thanks so much for your help!
On Monday, June 24, 2013 10:50:57 AM UTC-4, Gary Trakhman wrote:
>
> pst is printstacktrace, it's in the clojure.repl namespace and comes with
> clojure. Sometimes lein or something makes it available automatically,
> but if it isn't, you can (use 'clojure.
pst is printstacktrace, it's in the clojure.repl namespace and comes with
clojure. Sometimes lein or something makes it available automatically,
but if it isn't, you can (use 'clojure.repl) to get to it.
http://clojure.github.io/clojure/clojure.repl-api.html#clojure.repl/pst
Yes, switching to ma
Thanks a lot for tracing through my code! So, as I understand it, my
loop/recur is correct, but I was not using map in a correct way within the
vector functions.
By the way, what is your (pst e*) line doing? Is that from a debugging
library? I don't appear to have that in my clojure environment
I think the way to understand what's going on is to realize that laziness
(coming from map) creates extra thunks, for each iteration, you're creating
an extra stack frame to dereference the elements of the lazy seq.
(defmacro lazy-seq
"Takes a body of expressions that returns an ISeq or nil, and
Do you have the stack trace? It's not simple to run the code, but I made a
github project so we can look at it easier.
https://github.com/gtrak/grad-descent-test
When I run (gradient-descent example-grad [0 1] 0.001 0.001)
Here's the actual problem:
grad-descent.core> (pst *e)
StackOverflowError
Ah ok - so I may be using it wrong. I am not calling the function itself -
I was simply trying to bind local variables in a loop.
I have placed the code into gists for easier reading!
https://gist.github.com/anonymous/5841405#file-core-clj
https://gist.github.com/anonymous/5841420#file-vec-clj
An algorithm like that generating StackOverflowErrors suggests it's
recursing deeply, which suggests you're not using recur *enough*. If the
function calls itself, try to see if you can get that call into tail
position and change it to "recur".
On Fri, Jun 21, 2013 at 4:06 PM, P Martin wrote:
>