[ioke-dev] What should complex numbers look like?

  • From: Ola Bini <ola.bini@gmail.com>
  • To: ioke-language@googlegroups.com, dev@ioke.kenai.com, user@ioke.kenai.com
  • Subject: [ioke-dev] What should complex numbers look like?
  • Date: Thu, 12 Nov 2009 18:30:38 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=SUBl0rc5jzUf/Hx6CgZJ3SMO9cYMmRtFsKUs10V1GCuKKHcLI4uju5GbZxsWlPK4pE UbmNde2GQVrt1kEde5tLyBuEvlyfG31nt2tUFO8MtjmzSaZLfn1uSkCI6yhqt9//Wdd5 Zu4cam4famuLst3QZlA9z7J048TZXJAJ67NCM=

Hey,

Wanted some input here. I'm thinking about finishing the numeric tower for Ioke - and the two major omissions are currently complex numbers, and units/dimensions. I'm pretty sure about how to handle the latter, but complex numbers are slightly more complicated. The main complication is whether they should be given special syntax or not.

If not, it would possible work to represent them as a tuple where the second part is imaginary. That could be implemented using an "i" unit:

 (10, 4i) * 2

Not sure if that's the best approach, though.

Another alternative is to just to allow freefloating 4i literals that can be combined using +:

 10+4i

I would like to have a specific syntax for them if possible, though - so if someone comes up with a clever, clean way of representing complex numbers, it would be really helpful. =)

Cheers
--
 Ola Bini (http://olabini.com)
  Ioke - JRuby - ThoughtWorks

 "Yields falsehood when quined" yields falsehood when quined.



[ioke-dev] What should complex numbers look like?

Ola Bini 11/12/2009

[ioke-dev] Re: What should complex numbers look like?

Carlos Villela 11/12/2009
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close