A2. (instance? clojure.lang.IRecord (Foo.))

On 12 December 2012 14:53, Andy Fingerhut <andy.finger...@gmail.com> wrote:
> I haven't dug into the details, but this Clojure ticket looks like it might 
> be related, if not the same issue:
>
> http://dev.clojure.org/jira/browse/CLJ-1105
>
> It has been vetted by Stuart Halloway, so patches are welcome, but likely 
> wouldn't get in until after Clojure 1.5 is released (my guess).
>
> Andy
>
> On Dec 12, 2012, at 11:42 AM, Ben Wolfson wrote:
>
>> Given something like this:
>>
>> (defrecord F [a])
>>
>> This fails:
>>
>> (clojure.walk/postwalk identity [(F. 1)])
>>
>> because although (coll? (F. 1)) is true, (empty (F. 1)) fails ("can't
>> create empty").
>>
>> I've had to write an alternative to walk anyway (it discards
>> metadata), and I'd like it to be able to accommodate this case more
>> elegantly than calling empty and catching the exception if the object
>> happens to be a record. (I suppose the best way would be to define
>> walk in terms of something like fmap, so that individual records could
>> decide whether they can be recursed into or not, but that might be
>> overkill.)
>>
>> So:
>>
>> Q1: is this a bug in walk?
>> Q2: is there a way to tell if something is an instance of a class
>> created with defrecord?
>
> --
> 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