Planet Quantum News Up
 Contents   News   View 

Oct 17, 2010 - .NET #1 Previous Next

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)
93326215443944152681699238856266700490715968264381621468592963895217599993229915
608941463976156518286253697920827223758251185210916864000000000000000000000000
>(^ 10 100)
10000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000
>(SetPrecision 300)
300
>(Sin 1.)
.8414709848078965066525023216302989996225630607983710656727517099919104043912396
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 Secu
rity=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.)
.4400505857449335159596822037189149131273723019927652511367581717801382224780155
47930796592
>(EllipticK .5)
1.685750354812596042871203657799076989500800894141089044119948297893433702882346
760406450973
>


TXT Version: 101017.txt.



©2004-2024 Planet Quantum Kelly Roach