I'm persistently getting this. Annoyingly, it happens a long way through a
very big computation:
CompilerException java.lang.StackOverflowError,
compiling:(/tmp/form-init8817362891013362767.clj:1:1)
The content of file /tmp/form-init8817362891013362767.clj being compiled is
this:
(.deleteOnExit (java.io.File. "/tmp/form-init8817362891013362767.clj")) (do
(set! *warn-on-reflection* nil) (require (quote gorilla-repl.core))
(gorilla-repl.core/run-gorilla-server {:ip "127.0.0.1", :port 0,
:nrepl-port 0, :project "mw-explore", :gorilla-options nil, :version
"0.3.4"}))
I get the same error (although, obviously, not quite the same tmp file)
when I run at the repl rather than with Gorilla. The stacktrace does not
touch any file of mine.
The actual file of my own I'm evaluating is this:
https://github.com/simon-brooke/mw-explore/blob/master/src/mw_explore/mw_explore.clj
And it's calling into this library:
https://github.com/simon-brooke/mw-engine
And specifically, it's mainly exercising drainage:
https://github.com/simon-brooke/mw-engine/blob/master/src/mw_engine/drainage.clj
I acknowledge that this is a deep and nasty bit of algorithm, but the only
thing I can think of that would cause a stack overflow while compiling
would be an accidentally-recursive macro - and I'm not getting any of my
own macros.
This problem started after I introduced three new functions:
(defn is-hollow
"Detects point hollows - that is, individual cells all of whose
neighbours
are higher. Return true if this `cell` has an altitude lower than any of
its neighbours in this `world`"
[world cell]
;; quicker to count the elements of the list and compare equality of
numbers
;; than recursive equality check on members, I think. But worth
benchmarking.
(let [neighbours (get-neighbours world cell)
altitude (or (:altitude cell) 0)]
(= (count neighbours)
(count (get-neighbours-with-property-value
world (:x cell) (:y cell) 1 :altitude >)))))
(defn flood-hollow
"Raise the altitude of a copy of this `cell` of this `world` to the
altitude
of the lowest of its `neighbours`."
([world cell neighbours]
(let [lowest (get-least-cell neighbours :altitude)]
(merge cell {:state :water :altitude (:altitude lowest)})))
([world cell]
(flood-hollow world cell (get-neighbours world cell))))
(defn flood-hollows
"Flood all local hollows in this `world`. At this stage only floods single
cell hollows."
[world]
(map-world world
#(if (is-hollow %1 %2) (flood-hollow %1 %2) %2)))
However at the stage the problem occurs, these functions have evaluated
successfully, and am into the flow-world stage, which previously worked
reliably.
Has anyone seen anything analogous? Any pointers as to what I might be
doing wrong?
--
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
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.