code-reviews

2019-03-11T17:39:05.001400Z

Hello everyone! Nice to be here

2019-03-11T17:39:19.001700Z

I made a simple app with Clojure, and i want some feedback about the code, if i could have done something better, or designed better according to the 'clojure way', any feedback is appreciated! https://github.com/cybersapiens97/fastmusictube

2019-03-11T17:40:22.002300Z

(dorun (map f coll)) can be replaced with (run! f coll) https://github.com/cybersapiens97/fastmusictube/blob/master/src/fastmusictube/core.clj#L56

2019-03-11T17:40:57.002700Z

oh, that doesn't work with two collections though

2019-03-11T17:42:55.003800Z

yeah, my main function is one that i'm sure i could refactor it, because it's a little messy to be honest

2019-03-11T17:43:10.004400Z

but looking deeper, both collections are derived from separate line-seqs on the same file, you could consider one line-seq getting a series of name/resource tuples

2019-03-11T17:43:22.004600Z

but because there is a lot of side effects such as printing to the console, i found it to be hard to abstract it easily

2019-03-11T17:44:13.005200Z

also, fn / defn have an implicit do, so (defn -main [...] (do ...)) can just be (defn -main [...] ...)

2019-03-11T17:45:01.006100Z

Oh, i have just remembered, i was using a map with two seq's to show the user the actual music it was downloading but then i dropped this choice, i can refactor with dorun certainly

2019-03-11T17:46:03.007100Z

hmm i thought i should explicitly write do's to warn about side effects...

2019-03-11T17:46:29.007700Z

if you want to retain that, a transform that takes [a b c] and returns [[a (f a)] [b (f b}] [c (f c}]] is common, the core function juxt is designed for this sort of usage

2019-03-11T17:47:02.008300Z

to me -main is implicitly side-effecting, as is any function or let body with more than one form

1➕
2019-03-11T17:47:14.008500Z

gotcha