A multimethod which dispatches on type, or maybe extend the counted(?) protocol to these two types?
Erik. -- i farta > Den 1. jul. 2016 kl. 17.12 skrev lvh <_...@lvh.io>: > > Hi, > > > I have some code that wants to know the appropriate length of a byte buffer. > These can be byte arrays (as in [B) or java.nio.ByteBuffers. For the former, > I can call (alength ^bytes buf), for the latter I call (.remaining > ^ByteBuffer buf). Is there a way to just write a fn or macro that picks the > right one at compile time? I wrote some simple test fns, but there doesn’t > appear to be a way to access that type hinting information. > > > thanks > lvh > > -- > 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/d/optout. -- 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/d/optout.