From fbd0d93f759cd19bc43dd66d2793914ffafe13cb Mon Sep 17 00:00:00 2001 From: "Elf M. Sternberg" Date: Mon, 8 Dec 2014 11:23:39 -0800 Subject: [PATCH] Repeated lists of features is a code smell. Rationalizing those to a type makes code smaller, smarter. --- mp_suggest.hy | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mp_suggest.hy b/mp_suggest.hy index dea06a8..a57e617 100755 --- a/mp_suggest.hy +++ b/mp_suggest.hy @@ -177,6 +177,8 @@ "" (get (get cts 0) 1)))) +(defn tap [a] (print a) a) + (defn suggest [opts] (let [[(, local-artist local-album) (artist-album)] @@ -206,16 +208,12 @@ "--album \"{}\"" "--genre \"{}\"" "--song \"{}\"" - "\"{}\""] " ")]] + "\"{}\""] " ")] + + [finalizer (fn (seq) (+ [format-string] (list (map (fn [i] (get seq i)) (xrange 0 6)))))]] (ap-each newmp3s - (print (.format format-string - (get it 0) - (get it 1) - (get it 2) - (get it 3) - (get it 4) - (get it 5)))))) + (print (apply .format (finalizer it)))))) (defmain [&rest args] (try