On Tue, Jan 18, 2011 at 11:59 AM, Tim Visher <tim.vis...@gmail.com> wrote:
> Hi Everyone,
>
> I'm attempting to use Clojure to write a Wallpaper Library app. My
> first stab at a small subset of the functionality is done and I can't
> see how to improve it. I'm not particularly happy with it from a
> readability perspective as well as a visibility perspective.
>
> I find to-wallpaper-name and file-to-wallpaper to be the worst offenders.

Nothing strikes me as especially bad. There is a redundant "(.getName
file)" at the end of to-wallpaper-file that could be just "name", and
a linebreak in a group of close parentheses at the end of
do-file-wallpaper. I'm not sure the names of some of the functions are
the best, but they're mostly adequate to make the purpose of the code
clear. You might want to change to-dir-name to to-resolution-string
and (def to-dir-name to-resolution-string), and alter
to-file-name-suffix to call it as to-resolution-string; this separates
the two semantic meanings "the subdirectory name" and "the resolution
string" and allows you (or anyone) to later painlessly change the
subdirectory name to something else -- say, from resolution string to
category/resolution string, or width/height, or width_height, or
whatever.

As for the final doseq, perhaps it should be wrapped in a function
that takes source and dest arguments (and passes these down), and in
turn called by a -main that uses the wallpaper-source and
wallpaper-dest defs as these arguments. Then it can be turned into an
executable jar with gen-class that will do your doseq when launched.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to