[context tossed due to top posting.] On Tue, 8 Jun 2010 14:12:52 -0700 (PDT) Jason Smith <ja...@lilypepper.com> wrote:
> Why not just treat is as a vector, do vector math operations on it, > and be done with it? 1+2j is equivalent to [1 2]. 1+2j represents a > 2-D vector, does it not? Not only does this handle imaginaries, but > higher forms, such as [1 2 3 4]. The beauty of Lisp is that once you > accept the basic syntax (atoms and groupings), you don't have to worry > about developing EBNF forms for every arbitrary "human readable" > notation. > > Or I could be totally wrong. I think you're totally wrong. You don't have to worry about an EBNF for every arbitrary notation, but you do need one for the basic types in the language, so you can write them out and read them back in and know what you've got. When you read in an S-expression written by a program, you'd like know with 100% certainty whether the 2-element vector you read in is a Complex or just a random 2-element vector. Which means you need a standard representation over and above the two-element vector to represent a Complex constant. There's no good reason not to make that representation something familiar, especially if doing so will help Clojure better interoperate with other systems. Clojure already has a couple of numeric types that can be represented by a vector. Clojure also has rules making otherwise illegal symbols matching a specific pattern represent each of those types as literals, which deals with this problem (not sure that's *why* this was done, but it does deal with the problem.). Adding another pattern for an otherwise illegal symbol to represent a new numeric type seems like a logical thing to do. Besides which, as has been pointed out, tweaking the reader/writer to do this is relatively trivial compared with working out how complex is to be integrated into the numeric stack, much less doing that integration. <mike -- Mike Meyer <m...@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- 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