On Jan 19, 1:25 pm, Chouser <chou...@gmail.com> wrote:
> On Mon, Jan 19, 2009 at 4:07 AM, Anand Patil
>
> <anand.prabhakar.pa...@gmail.com> wrote:
>
> > Sorry, I was not being clear. Why not just let (deref 5) return 5? I
> > would consider that syntactic sugar, as it would make it easier to
> > deref a mixed vector of refs, constants, agents and atoms without
> > keeping track of which indices correspond to (ref, agent, atom)s and
> > which to constants.
>
> You can do this yourself quite easily:
>
> (defn my-deref [x] (if (instance? clojure.lang.IRef x) @x x))
>
> (my-deref 5)  ==> 5
> (my-deref (var filter))  ==> #<core$filter__3586
> clojure.core$filter__3...@1e1be92>
> (my-deref filter)  ==> #<core$filter__3586 clojure.core$filter__3...@1e1be92>
> (my-deref (agent 99))  ==> 99
>
> I don't know if the builtin 'deref' should do this -- it seems like it
> might make things more confusing rather then less.
>
> --Chouser

Thanks Chouser, I'll take your word for it & use a specialized
function.

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