srikumarks / muSE

Automatically exported from code.google.com/p/muvee-symbolic-expressions
Other
6 stars 2 forks source link

Some compatibility with standard scheme idioms will be helpful in porting. #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Though I don't think full R5RS compliance is expected or needed in muSE,
some compatibility is definitely possible without compromising the more
useful and general feature of muSE. 

1. (define ...) currently supports only (define f (fn (y) ..)) to define
functions. Supporting (define (f y) ..) as is done in standard scheme is
useful and nicer for creating nested and curried definitions such as
(define ((f x) y) ...) 

2. The scope of define should be restricted to the local lexical scopre of
fn, let and case. Currently define really can only be used to define global
entities. Introducing local variables using define is useful when
programming in the large.

Original issue reported on code.google.com by srikuma...@gmail.com on 29 Mar 2007 at 6:59

GoogleCodeExporter commented 9 years ago

Original comment by srikuma...@gmail.com on 29 Mar 2007 at 7:00

GoogleCodeExporter commented 9 years ago
The (define (f a b) ..) form is supported since v234 of trunk.

Original comment by srikuma...@gmail.com on 30 Mar 2007 at 5:08

GoogleCodeExporter commented 9 years ago
Call a lambda a lambda! muSE uses the symbol "fn" to mean what is referred to as
"lambda" in standard Scheme. This is 'cos muSE is used by people who might be 
scared
away if they see too many "lambda" expressions floating around ... but they
understand functions (thanks to JavaScript) and can easily read "fn" as an
abbreviation of "function". 

That said, only allowing "fn" breaks code compatibility. So now, with this 
change,
both "fn" and "lambda" can be used.

(Addition made in version 263)

Original comment by srikuma...@gmail.com on 10 Jun 2007 at 8:08

GoogleCodeExporter commented 9 years ago
A bit more about comment 2 - the standard define form.

As previously stated, muSE now supports the usual Scheme define construct for
function definition. So you can do -
  (define (f a b) body...) instead of (define f (fn (a b) body...))
  (define ((f a) b) ...) instead of (define f (fn (a) (fn (b) body...)))
etc.

Such normal constructs come with full pattern matching bind support, so that 
you can
deconstruct lists, match against constants, place guards, etc. The pattern 
matching
part of the function specification using define does not fit within the scope 
of what
is expected of Scheme.

Original comment by srikuma...@gmail.com on 10 Jun 2007 at 8:17