specification by implications and example Matthias Felleisen (16 Jan 2000 14:49 UTC)
Re: specification by implications and example Per Bothner (16 Jan 2000 21:33 UTC)
Re: specification by implications and example Shriram Krishnamurthi (16 Jan 2000 23:28 UTC)
Re: specification by implications and example Per Bothner (17 Jan 2000 00:14 UTC)
Re: specification by implications and example Matthias Felleisen (17 Jan 2000 00:34 UTC)
Re: specification by implications and example Shriram Krishnamurthi (17 Jan 2000 00:52 UTC)
Re: specification by implications and example Per Bothner (17 Jan 2000 01:38 UTC)

Re: specification by implications and example Per Bothner 16 Jan 2000 21:33 UTC

Matthias Felleisen <xxxxxx@rice.edu> writes:

> >> The special form set! is extended so the first operand can be a procedure
> application,
> >> and not just a variable.
> The examples that follow, however, are all of the shape (set!  (procedure-name
> ...) ...).

> The examples that follow, however, are all of the shape
>  (set!  (procedure-name ...) ...)

That *is* a procedure application.  I guess the correct R5RS terminology
is that the first set! operand can be a "procedure call".

> So, where is the syntax specification for this new/extended form? In this day
> and age, that's the
> minimum we can expect. Is it
>
>   (set!  exp exp)

No - that would be ambiguous.

> or
>
>   (set! (p exp ...) exp)
>
> or what?

The latter.

> Also,  if what we see is all there is to it, I would think that a syntax-rules
> specification  can be written.
> If so, supply it.

(define-syntax set!
  (syntax-rules ()
    ((set! (proc args ...) value)  ;; Assuming Alternative 1
     ((setter proc) args ... value))
    ;; ((set! (proc args ...) value) ;; Assuming Alternative 2
    ;;  ((setter proc) value args ...))
    ((set! var value)
     (%%builtin-set! var value))))

-where %%builtin-set! is set! as defined in R5RS.

I didn't include it partly because I don't believe
        ((setter proc) args ... value)
is a valid R5RS template.  However, it's meaning should be clear.
--
	--Per Bothner
xxxxxx@bothner.com   http://www.bothner.com/~per/