[plt-scheme] Volunteers: help with Moby!

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Jan 16 11:57:43 EST 2009

On Jan 16, 2009, at 9:32 AM, Sigrid Keydana wrote:

> (program->java-string '(+ 2 3))


in drscheme's teaching languages has the following meaning:

   add the rational 2 to the rational 3


> in drscheme, and the output
>
> "static { org.plt.Kernel.identity(org.plt.Kernel._plus_); }\nstatic {
> org.plt.Kernel.identity((new org.plt.types.Rational(2, 1))); } 
> \nstatic {
> org.plt.Kernel.identity((new org.plt.types.Rational(3, 1))); }\n"

Now read this as a sequence of static blocks to be added to a class's  
static init protocol:

  new org.plt.types.Rational(2, 1) // makes the rational # 2  
(rationals are two integers)
  new org.plt.types.Rational(3, 1) // 3
  org.plt.Kernel._plus_  // a command for adding

Now you can ask the precise questions:

  -- what are the identity methods doing here
  -- how do the numeric constants and the plus operation get hooked up.




Posted on the users mailing list.