Wow, lots of good tips, thanks.    I'm still digesting some of the finer
bits.

Observations:

- The refheap pastebin link was useful for future code posts.
- The :pre/:post conditions pointer was good, I vaguely new of them, but
hadn't used them.
- The as-> form was new (and useful) to me.  In general I'm still
struggling to fit -> and friends into my style.
- I found the #4 variant easiest to read, didn't even occur to me to do
such a thing, coming from common lisp I'm still trying to get used to [],
{}, #{} options.  Unfortunately #4 also added the most undesired entries to
the map (see question below).

Questions:

- The only problem with the variants is that they introduce nil valued
entries in the map where my original function only added map entries if the
namespace relationships existed, I'd like to preserve that.  Presumably I
could add an "assoc-if" or similar type thing to avoid adding nil valued
entries. Maybe clojure already has such a construct?  My preference is to
avoid adding them in the first place, rather than filtering them from the
map in a post-construction operation.

- 'pr-str' almost seems redundant with 'str', but I suppose it observes
pretty printing guidelines where str would not?  Any significant nuances
here, or are these two functions largely redundant?

- Your many suggestions certainly seem preferable to my state based
approach, but for my edification, what is the optimal way to implement a
state based approach in this example?  I wasn't sure about my use of vars
versus, say, atoms, or other clojure constructs for mutable state.  Just
looking for suggestions here.

Thanks again, really useful stuff!

On Sat, Nov 30, 2013 at 7:41 PM, Sean Grove <s...@zenboxapp.com> wrote:

> Dave, I may not have totally understood the original function, but here
> are a few possible implementations, each moving towards what I would think
> of as being simpler: https://www.refheap.com/21379
>
> It could of course be made more efficient and slightly cleaner, but maybe
> it's a start.
>
> On Sat, Nov 30, 2013 at 3:49 PM, Dave Tenny <dave.te...@gmail.com> wrote:
>
>> What, not conj!urers?
>>
>>
>> On Sat, Nov 30, 2013 at 6:33 PM, Thomas <th.vanderv...@gmail.com> wrote:
>>
>>> On Saturday, November 30, 2013 11:17:01 PM UTC, Dave Tenny wrote:
>>>
>>>> I'm still learning clojure and wrote this decidedly unfunctional bit of
>>>> code as part of a common lisp style DESCRIBE function.
>>>>
>>>> I was wondering what experienced clojure-ers  (what's the proper
>>>> reference?)
>>>>
>>>
>>> Clojurians ;)
>>>
>>> Thomas
>>>
>>> --
>>> --
>>> 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 a topic in the
>>> Google Groups "Clojure" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/clojure/gbg1ABsbT-I/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> clojure+unsubscr...@googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
>> --
>> 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 unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> --
> 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 a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/gbg1ABsbT-I/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to