New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract region utils to cljam.util.region and add some functions. #110
Conversation
Codecov Report
@@ Coverage Diff @@
## master #110 +/- ##
=========================================
+ Coverage 85.28% 85.5% +0.22%
=========================================
Files 61 62 +1
Lines 4029 4085 +56
Branches 400 399 -1
=========================================
+ Hits 3436 3493 +57
Misses 193 193
+ Partials 400 399 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the refactoring and additional convenient functions. I added a few comments. Please check them.
src/cljam/tools/cli.clj
Outdated
@@ -16,7 +16,8 @@ | |||
[cljam.algo.pileup :as plp] | |||
[cljam.algo.convert :as convert] | |||
[cljam.algo.level :as level] | |||
[cljam.util :as util]) | |||
[cljam.util :as util] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cljam.util
seems no more needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Removed the requirement.
src/cljam/util/region.clj
Outdated
(do (vreset! last-reg x) r))))))) | ||
([^long max-gap-merged regs] | ||
(merge-regions max-gap-merged regs #(update %1 :end max (:end %2)))) | ||
([^long max-gap-merged regs merge-fn] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think merge-fn
should be located in front like clojure.core/merge-with ([f & maps])
. The last regs
is convenient for sequence processing such as ->>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, that is a problem with the order of multi-arity function. Umm, if so, it may be better to provide merge-regions-with
function ...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! That's a good idea! I split the function into merge-regions-with
and merge-regions
.
src/cljam/util/region.clj
Outdated
|
||
(defn complement-regions | ||
"Returns a sequence of regions complement to in-regions. | ||
in-regoins must be sorted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo of in-regions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks!
f1b6447
to
cbe4dd7
Compare
Thanks :) |
Thank you for the helpful advice! |
Summary
cljam.util
tocljam.util.region
merge-regions
,subtract-region
andcomplement-regions
Tests
lein test :all
馃啑