Closed BrunoBonacci closed 8 years ago
That's an interesting one - I haven't used those settings before. It sounds like the default behavior is ok (no limits), but if you have them set then it's not explicitly unsetting them before script generation.
It should be relatively straightforward to explicitly bind them to false for script generation. Let me take a quick stab at that.
yes, you are right. By default are set nil
but anyone who is using the REPL do develop on Clojure has these set in the profiles.clj
to avoid to hang the REPL on a infinite sequence.
As mentioned as well the workaround of the binding form works well
(binding [*print-length* false]
(write-script .....))
But it would be better that the generate-script
does it internally,
so that people who have large number of fields won't stumble across the same issue.
Released in v0.3.3
Tested, it works. many thanks for the quick response.
Hi,
one of my datasets has close to 700 fields, however the
write-script
function only generates a smaller number. This is due to the Clojure behaviour ofprint
andstr
function which depends on*print-length*
.When working with the REPL you typically have a
(set! *print-length* 100)
in your.lein/profiles.clj
This causes long sequences (and infinite lazy sequences) to only print the first 100 items.Clojure print functions (and
str
) obey to this setting. So for example the following code will generate a incorrect output:now the output script will look like:
Go at the end of the above line and notice the
...
after:value100
.So only the first 100 values were printed.
Now a workaround for this issue is to wrap the
write-script
in abinding
like:But I feel this should be handled by the
generate-script
directly. Additionally you might want to check the*print-level*
as well.[1] - https://clojuredocs.org/clojure.core/*print-length [2] - https://clojuredocs.org/clojure.core/print-level*