[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:

<readme>
Inspector Gadget

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

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
oneline
NewtonScript hacks to PIEDTS!

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

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

http://home.comcast.net/~saweyer/newton/newtdev.htm

What is very interesting about this package is the implementation of
WallyMath!!

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)
begin
   if (slot = 'text) then
     if EndsWith(self.text, "=") then
     begin
       try
           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
       begin
          local e;
          e := CurrentException();
          Print("Error compiling xFunc...");
          :SysBeep();
          self.lastText := Clone(self.text);
          return;
       end;

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

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

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.

Suggestions?

Thanks,

Josh--
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