Hi Phillip, I've had a very quick look at the code and I've spotted a few issues, here's my feedback:
1- all your functions will cause input args and return value to be boxed. There's a few ways to avoid it, none of which are particularly pretty. If your library is not worried about performance but just about behaviour then this is not a problem, if it is, I can guide you through ways to avoid boxing (primitive type hinting of ints and floats is unfortunately not an option). 2- defining a var called &, while technically valid, is not a good idea. syntax-quote will not resolve vars named & to avoid collision with the & rest syntax in destructuring, so I'd consider using a different name 3- clojure/core encourages libraries to provide "sufficiently uniquely named data literals", p/i and p/f to me while convenient don't seem unique enough to be safely included in a library. This one could be detabatable Nicola > On 3 Jul 2017, at 10:44, Phillip Lord <phillip.l...@newcastle.ac.uk> wrote: > > > > This is the first alpha release of my new library! Comments welcome. > > Clojure has an extensive system for dealing with numbers, including > error on overflow, or auto-promotion, defaulting to long and double data > types. > > This is all well and good, but irritating if you need to implement an > algorithm which depends on ints overflowing for instance. While, clojure > provides functions for operating over ints, the names tend to be long > and wieldy, such as clojure.core/unchecked-int-add. Clojure is also > rather inconsistent; for example, the bit-shifting operators in Java are > not accessible in Clojure over ints. > > This library provides accessible, easily named float and int functions > for Clojure. Where possible, functions with the same name as the > operators are provided as well as names (<< and left-shift). Three Java > operators are not valid symbols in clojure (~, % and ^), so just have > names. Short reader literals are also provided to simplify the creation > of ints and float. > > (require '[primititve.operator.integer :as i]) > > (i/+ 10 10) > => 20 > > (type (i/+ 10 10)) > => java.lang.Integer > > (i/add 10 10) > => 20 > > (i/not 10) > => -11 > > (i/+ #p/i 10 #p/i 10) > => 20 > > > https://github.com/phillord/primitive-operator > > -- > 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.
signature.asc
Description: Message signed with OpenPGP