If you go down that path, I think vec
(http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/vec)
is worth looking at.

I've always understood that vec turns lists into vectors, but leaves
vectors alone... which looks like what you are doing.

On Mon, Apr 16, 2012 at 1:02 PM, kurtharriger <kurtharri...@gmail.com> wrote:
>
> On Apr 16, 10:45 am, Stuart Sierra <the.stuart.sie...@gmail.com>
> wrote:
>> As an alternative, you could quote the entire expression (you can quote
>> anything, not just lists) when copying data structures into a test.
>>
>> -S
>
>
> It never occurred to me to do that.... so I guess that works...
>
> As my alternative, I went off and wrote this as I find it easier to
> mentally parse datastructures that uses vectors rather than quotes.
>
> (defn lists->vectors
>  "Replaces lists and lazy sequences with vectors"
>  [obj]
>  (let [f #(if (or (list? %) (instance? clojure.lang.LazySeq %))
> (apply vector %) %)]
>    (postwalk f obj)))
>
> --
> 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 at
http://groups.google.com/group/clojure?hl=en

Reply via email to