Up
Oct 17, 2010 - .NET #1

Futuristic Planet Quantum Image Hi again from PLANETQUANTUM.COM. No one has solved my Challenge Problems yet, but I don't doubt that some of you out there could do so if you try.

Today, however, I'd like to give you a preview of some things to come. Can you imagine a Lisp-like CAS language that also has .NET capabilities? Here at PLANETQUANTUM.COM, we are making it happen. Below is some Quantum 2010 console output, including bits of computer algebra, database, networking, and web interaction.



>(Factorial 100)
9332621544394415268169923885626670049071
5968264381621468592963895217599993229915
6089414639761565182862536979208272237582
51185210916864000000000000000000000000
>(^ 10 100)
1000000000000000000000000000000000000000
0000000000000000000000000000000000000000
000000000000000000000
>(SetPrecision 300)
300
>(Sin 1.)
.841470984807896506652502321630298999622
5630607983710656727517099919104043912396
68948639744
>(ForEach (x #[[1 2][3 4]]) (Print Console.Out x))
1
2
3
4
NULL
>(Setq request (WebRequest.Create "https://www.planetquantum.com"))
System.Net.HttpWebRequest
>(Setq response (request.GetResponse))
System.Net.HttpWebResponse
>(Setq reader (New StreamReader (response.GetResponseStream)))
System.IO.StreamReader
>(reader.Peek)
60
>(Console.WriteLine (reader.ReadLine))
<!------------------------------------------------------------->
NULL
>(Expand (^ (+ x 1) 5))
(+ 1 (* 5 x) (* 5 (^ x 4)) (* 10 (^ x 2)) (* 10 (^ x 3)) (^ x 5))
>(Setq connectString "Data Source=localhost;Initial
Catalog=Test;Integrated Security=True")
"Data Source=localhost;Initial Catalog=Test;Integrated
Security=True"
>(Setq sql "SELECT * FROM [Planets]")
"SELECT * FROM [Planets]"
>(Setq connection (New SqlConnection connectString))
System.Data.SqlClient.SqlConnection
>(connection.Open)
NULL
>(Setq command (New SqlCommand sql connection))
System.Data.SqlClient.SqlCommand
>(Setq reader (command.ExecuteReader))
System.Data.SqlClient.SqlDataReader
>(reader.Read)
TRUE
>(Console.WriteLine "Name={0}, Temp={1}" (Elt
reader "Name") (Elt reader "Temp"))
Name=Sun, Temp=9941
NULL
>(reader.Close)
NULL
>(connection.Close)
NULL
>(Setq ping (New Ping))
System.Net.NetworkInformation.Ping
>(Setq options (New PingOptions))
System.Net.NetworkInformation.PingOptions
>(Setq options.DontFragment TRUE)
TRUE
>(Setq string "Quantum")
"Quantum"
>(Setq bytes (Encoding.ASCII.GetBytes string))
[81 117 97 110 116 117 109]
>(Setq timeout 120)
120
>(Setq host "www.planetquantum.com")
"www.planetquantum.com"
>(Setq reply (ping.Send host timeout bytes options))
System.Net.NetworkInformation.PingReply
>reply.RoundtripTime
98
>(Load "~\\Test\\PingTest.q")
"C:\Planet Quantum\Quantum 2010.0\Test\PingTest.q"
>(Pretty Console.Out PingTest)
(Def (PingTest host)
  (Local ping options string bytes timeout reply)
  (Setq ping (New Ping))
  (Setq options (New PingOptions))
  (Setq options.DontFragment TRUE)
  (Setq string "Quantum")
  (Setq bytes (Encoding.ASCII.GetBytes string))
  (Setq timeout 120)
  (Setq reply (ping.Send host timeout bytes options))
  (Cond ((== reply.Status IPStatus.Success)
         (Console.WriteLine "Address: {0}" reply.Address.ToString)
         (Console.WriteLine "RoundtripTime: {0}" reply.RoundtripTime)
         (Console.WriteLine "Time To Live: {0}" reply.Options.Ttl)
         (Console.WriteLine "DontFragment: {0}" reply.Options.DontFragment)
         (Console.WriteLine "Buffer.Length: {0}" reply.Buffer.Length)))
  (Return reply.Status))
NULL
>(PingTest "www.planetquantum.com")
Address: 65.254.231.151
RoundtripTime: 97
Time To Live: 239
DontFragment: True
Buffer.Length: 7
Success
>(HttpUtility.HtmlEncode "<Planet>Quantum</Planet>")
"&lt;Planet&gt;Quantum&lt;/Planet&gt;"
>(Setq prime1 (RandomPrime (^ 10 10) (^ 10 11)))
11059457203
>(Setq prime2 (RandomPrime (^ 10 10) (^ 10 11)))
36610742141
>(IFactor (* prime1 prime2))
[1 [[11059457203 1] [36610742141 1]]]
>(* prime1 prime2)
404894935878458091623
>(BesselJ 1. 1.)
.440050585744933515959682203718914913127
3723019927652511367581717801382224780155
47930796592
>(EllipticK .5)
1.68575035481259604287120365779907698950
0800894141089044119948297893433702882346
760406450973
>


TXT Version: 101017.txt.