[NTLK] WallyMath

From: Josh Burker <newt_talk_at_mac.com>
Date: Fri Nov 10 2006 - 02:33:04 EST

I have been reading Maurice Sharp's reminisces about early Newton
development with much interest, and I was particularly struck with
the Math Recognizer that was originally planned for the Newton OS.

While looking for source code to ethernet drivers (can anyone point
me in a direction?) I downloaded the NTK Sample Code archive from
UNNA. Interestingly, in the Sample Code/NewtonScript/Inspector
Gadget directory there is a Newton Package called Inspect whose
readme is as follows:

Inspector Gadget

Demonstrates the use of the Compile() function to write NewtonScript
on the

Pretty cool idea, but pretty lame once you actually try it. The
Newton is
very bad at recognizing NewtonScript so you use the keyboard a lot,
and itís
hard to edit... but you can do some neat oneliners. Send your cool
NewtonScript hacks to PIEDTS!

The old WallyMath sample has been integrated now, for mathematical
just write in the expression and an = sign.

Steve Weyer has a better way to develop in NewtonScript on the Newton
with NewtDev:


What is very interesting about this package is the implementation of

I loaded it on my new eMate (thanks Woody!!) and gave it a whirl.
Just something simple: '2 + 3 =' to see what it spits out.
Inspector was filed in Extras and it opened fine on the eMate. There
was a special pane in Inspector labeled WallyMath: I tapped with the
stylus into the field and typed on the keyboard: 2+3=

and instantly '5' appeared in the field!! I did not even have to hit
Return! I also tried '(8 + 2) / 2 =' and it worked great!

The important code that makes this all happen is here (it might be
garbled in the post to the list):

func(slot, view)
   if (slot = 'text) then
     if EndsWith(self.text, "=") then
           self.xfunc := Compile(SubStr(self.text, 0, StrLen
(self.text) - 1));

       onexception |evt.ex| do //This should actually also catch div
0 but doesn't
          local e;
          e := CurrentException();
          Print("Error compiling xFunc...");
          self.lastText := Clone(self.text);

          SetValue(self, 'text, NumberStr(Clone(self:xfunc())));
       onexception |evt.ex| do
          local e;
          e := CurrentException();
          Print("Error calling xFunc...");

       self.lastText := Clone(self.text);

So, we have source code to the WallyMath function and it runs under
Newton OS 2.1. The code specifies that we are free to implement it
so long as the code has credit as originating from Apple. How can we
proceed to build a patch to Notes and perhaps NewtonWorks that will
allow the implementation of WallyMath into these packages? With the
source code it ought to be a matter of simply allowing Notes and
Works to access this "recognition," for lack of knowing the proper
terminology, that a patch might offer.



This is the NewtonTalk list - http://www.newtontalk.net/ for all inquiries
Official Newton FAQ: http://www.chuma.org/newton/faq/
WikiWikiNewt for all kinds of articles: http://tools.unna.org/wikiwikinewt/
Received on Fri Nov 10 02:33:14 2006

This archive was generated by hypermail 2.1.8 : Fri Nov 10 2006 - 18:30:00 EST