Stuart, thanks for your reply. Those are very helpful and constructive
criticisms -- exactly what I was looking for.

It only pings the ips once -- looking for existing hosts or non-
existent hosts, depending on the arguments passed to the script.

Coming from Ruby, using keywords (they resemble Ruby "symbols") as
functions is a bit foreign to me. Need to work on that for sure.

Also need to look through the standard lib a few hundred times to get
a feeling for all the functions available to me.

-Tim

On May 10, 7:15 am, Stuart Halloway <stuart.hallo...@gmail.com> wrote:
> Hi Tim,
>
> Very readable -- a good first program!  A few things you might do  
> differently:
>
> (1) Keywords are fns. You don't have to say #(:exists %) -- just  
> say :exists !
>
> (2) You can apply the same trick as in #1 to #(not (:exists %)) by  
> using remove instead of filter.
>
> (3) Similarly, #(:ip %) could be just :ip
>
> (4) Take a look at using futures instead of agents.
>
> (5) Maybe rewrite some nested forms using ->
>
> (6) Aren't you pinging all the ips twice?
>
> (7) You could build used-ips as a set.
>
> Happy Clojuring,
> Stu
>
> On May 9, 2010, at 9:42 AM, Tim Morgan wrote:
>
>
>
> > I picked up Programming Clojure by Stuart Halloway last week and am
> > working through the book. I'm coming from a Perl/Python/Ruby
> > background, so Java + Lisp + functional programming is all new to me.
>
> > I thought a good exercise would be to write a script that pings all
> > ips on a subnet looking for existing hosts, since I've written the
> > same thing in Ruby before.
>
> > The script I came up with is here:http://gist.github.com/395153
>
> > It works (and it's considerably faster than my Ruby equivalent!), but
> > I'm not certain it's idiomatic Clojure, and would love if someone
> > could critique me a bit. Tear it apart.
>
> > Thanks!
>
> > -Tim Morgan
>
> > --
> > 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
>
> --
> 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 
> athttp://groups.google.com/group/clojure?hl=en

-- 
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