Just cheerleading: I, for one, would love for Clojure to have complex number 
support, however it can be arranged (built-in or through a library). 

I sometimes do quantum computing work and this issue has prevented progress on 
a couple of projects. I haven't tried to solve the problem myself, and I'm not 
sure exactly what the difficulties are in detail, but a couple of strong 
students have worked on this for me and been stymied.

I started my quantum computing work in Common Lisp, where complex numbers are 
free and easy... and it's frustrating that this (and only this) has prevented 
us from continuing that work now that we've switched to Clojure for almost 
everything else.

 -Lee



> On Apr 27, 2015, at 1:52 PM, Andy Fingerhut <andy.finger...@gmail.com> wrote:
> 
> People frequently make their own modified versions of Clojure without having 
> their changes made part of the core Clojure distribution.  That is why I said 
> "depending upon your goals".  If your goal is to try it out and learn from 
> it, and you don't care whether it becomes part of the standard Clojure 
> distribution, then it does not matter what the Clojure core team's priorities 
> are, because they are not involved.
> 
> Andy
> 
> On Mon, Apr 27, 2015 at 10:46 AM, endbegin <nkripl...@gmail.com 
> <mailto:nkripl...@gmail.com>> wrote:
> As far as I know, Java Math does not have a complex number type. Some 
> implementations of a complex number exist (such as Apache Commons Math), but 
> they create a Complex class that implements Serializeable and a Commons 
> specific interface.  
> 
> Modifying clojure.core itself is a bit daunting, and like you said, it would 
> need to be a priority for the core team.
> 
> 
> 
> On Monday, April 27, 2015 at 12:45:46 PM UTC-4, Andy Fingerhut wrote:
> Unless the Java Math library handles complex types already, I don't know of 
> any way to extend it in a way that would let you get the answer you want from 
> (Math/abs my-complex-number) in Clojure.
> 
> If you want code that gives the correct answers, a library using vectors or 
> maps for complex numbers can get you there.  Memory footprint and performance 
> should be better with Clojure records or a new class written directly in 
> Java.  With a library, I don't know of any way to be able to mix Clojure's 
> arithmetic operations like + - * / etc. with its existing numeric types, and 
> your new library-implemented complex types.
> 
> Support of Clojure's arithmetic operations on complex numbers might only be 
> achievable by modifying Clojure itself.  Depending upon your goals, the down 
> side of that approach is that it will not become part of the normal Clojure 
> distribution unless the Clojure core team wants that addition, which I would 
> guess would be very low on their priority list (just a guess -- I have no 
> inside knowledge there).
> 
> Andy
> 
> On Mon, Apr 27, 2015 at 8:39 AM, endbegin <nkri...@gmail.com <>> wrote:
> I have been thinking along the lines of mikera and Maik - and it seems like 
> there is no further progress here? I would like to take a crack at creating a 
> complex number type, but implemented as a library to Clojure. I am not sure 
> where to start, and if anyone here has suggestions, I'd be happy to hear 
> them. 
> 
> A complex number could simply be a vector of two elements, or a map with 
> :real and :imag keys (or something lightweight) - and I am not sure what it 
> would require to make this type work happily with code arithmetic functions 
> in Clojure and Java Math. 
> 
> It would also have to work with seq operations in Clojure - for instance: 
> If I have a complex number c = {:real 3 :imag 4}, and a vector v = [1 -2 c], 
> it would be nice to have the call 'map #(Math/abs %) v' produce (1 2 5). 
> 
> I am having trouble figuring out all the pieces that need to be implemented. 
> Is it even possible to implement this as a library, or does this need to be a 
> part of clojure.core?
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@googlegroups.com <>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en 
> <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+u...@googlegroups.com <>.
> For more options, visit https://groups.google.com/d/optout 
> <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 
> <mailto: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 
> <mailto:clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en 
> <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 
> <mailto:clojure+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <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 
> <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 
> <mailto:clojure+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

--
Lee Spector, Professor of Computer Science
Director, Institute for Computational Intelligence
Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspec...@hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

-- 
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.

Reply via email to