philoskim / debux

A trace-based debugging library for Clojure and ClojureScript.
468 stars 19 forks source link

d macro truncates sequences #4

Closed danielcompton closed 6 years ago

danielcompton commented 6 years ago
(count (range 200))
=> 200
(count (debux.dbgn/dbgn (range 200)))
=> 100

I think this is because of this line:

https://github.com/philoskim/debux/blob/master/src/debux/dbgn.clj#L218-L219

The limited result# should probably be renamed to a different name so that the unchanged result can be passed through safely.

philoskim commented 6 years ago

I will correct it in the next version like the following if this is what you mean.

......
         result# ~form
         result2# (ut/take-n-if-seq n# result#)]
     (when (or dup# (ut/eval-changed? evals# form# result2#))
       (ut/print-form-with-indent (ut/form-header form# msg#)
                                  (:indent-level @ut/config*))
       (ut/pprint-result-with-indent result2# (:indent-level @ut/config*)))
     result#))
......

Test result after correction:

(set-print-seq-length! 10)

(dbgn (count (range 200)))
dbgn: (count (range 200)) =>
| (range 200) =>
|   (0 1 2 3 4 5 6 7 8 9)
| (count (range 200)) =>
|   200

It didn't occur to me before your suggestion. Thank you for good advice!

danielcompton commented 6 years ago

Yep that looks good. Thanks!