I agree that complex would be a better name. It would be also be nice if it the 1-arg version could be idempotent (i.e. returns an existing complex number unchanged). The downside is that this would mean a slight performance hit because it would prevent the use of primitive arguments. Maybe we should do this but still use primitive type hints for the 2-arg version?
On Wednesday, 3 June 2015 01:17:49 UTC+1, Christopher Graham wrote: > > How about changing the name of the complex-number function to, ideally, > complex ? > complex-number seems irritating to (have to) read. Further, calling this > function is a form of type coercion. (float ...), (int ...), etc., are > idiomatic Clojure, whereas (float-number ...), (int-number ...), etc., were > not included in the language. > > > On Sunday, May 31, 2015 at 6:55:46 PM UTC-4, Alan Forrester wrote: >> >> https://clojars.org/complex >> >> https://github.com/alanforr/complex >> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Falanforr%2Fcomplex&sa=D&sntz=1&usg=AFQjCNHm4m5mR8UisNf-JFm-AbPGOX2Srg> >> >> >> Complex is a Clojure library for doing complex number calculations >> that wraps the Java commons-math3 Complex library. >> >> complex >> >> A Clojure library for doing calculations with complex numbers. Wraps >> the Java commons-math3 Complex library. >> >> Usage >> >> A complex number can be created by invoking the complex number >> function. With one argument the function produces a complex number in >> which only the real component is non-zero. With two arguments, the >> first argument is the real part, the second argument is the imaginary >> part: >> >> => (complex-number 1) >> >> Complex (1.0, 0.0) >> >> => (complex-number 1 2) >> >> Complex (1.0, 2.0). >> >> The library can be used to do complex arithmetic. The + function can >> have any number of real or complex arguments but always produces a >> complex result. >> >> => (+ 1 (complex-number 3 4)) >> >> Complex (4.0, 4.0). >> >> The same is true of the other arithmetical operations *,-,/. The >> arithmetical functions are fastest on a per number basis when used on >> only two arguments. They are also faster when their arguments are >> complex. >> >> The library also provides other functions, such as (pow a b), which >> raises a to the power b, (sin a) which calculates the sine of a, and >> several other functions. For details, see the docs. >> >> Alan >> > -- 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.