[plt-scheme] Re: conventional syntax

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Thu May 25 14:18:40 EDT 2006

At 8:19 AM +0200 5/7/06, Matthew Flatt wrote:
>In the current version of DrScheme in the SVN repository, if you use
>DrScheme's "(module ...)" language, you can run the program
>  #honu
>  function len(lst) {
>    if (isEmpty(lst))
>      return 0;
>    else
>      return 1+len(rest(lst));
>  }
>  var myList = list(1, 2, 3, 4);
>  len(myList);
>You'll see the result 4.
>The function `len' and the list `myList' above are Scheme values ---
>and they're values in this new language, as are all Scheme values.
>The new language will extensible in the same way as Scheme. I haven't
>written the new version of `define-syntax', but much of the
>infrastructure is already in place (and it's used to implement the
>forms above).
>We've only barely started, and there's a long way to go before it's
>useful: completing the core language, building a suitable pattern
>matcher for macros, re-writing all of the documentation so that it can
>be viewed from either world, adjusting error messages for different
>contexts, and more. I'm not sure that it will work, and I think we'll
>have to invest a lot of effort to find out.

I'd like to propose a pedagogical language ("AlJabr"?) that 
corresponds as closely as possible to the syntax and semantics of 
high school algebra.  It's not intended to be useful for programming, 
but only for
demonstrating the structure and interpretation of algebraic 
expressions.  Here are the constructs:

Two types: number and Boolean (the former including integers, 
fractions, and inexact floats as in Scheme)
the prefix unary operator -
the infix operators +, -, *, /, ^ (for exponentiation) with the usual 
order of operations
the infix operators <, >, <=, >=, =, !=, ditto
the infix operators "and" and "or", ditto
an implicit multiplication operator interpolated into "3x+4" and the like
parentheses used to disambiguate precedence, as in high school algebra
a few standard prefix functions like sqrt(x), cos(x)
variable definition (but not mutation) using the notation "let x = 3+4"
function definition using the notation "let f(x,y) = 3x+y"
No structs, symbols, strings, macros, lists, etc. because these 
things aren't covered in a high school algebra course.
MAYBE conditionals, using the syntax "if condition then expression 
else expression"
There should definitely be a Stepper, which counts "making implicit 
multiplication explicit" as a step.

To the teachers reading this: would that be useful?
To the PLT geeks reading this: how long would it take to design and implement?
							Stephen Bloch
							Math/CS Dept
Adelphi University
sbloch at adelphi.edu

Posted on the users mailing list.