[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ``Update functions'' in Scheme.
> [example where a function (setter accessor) obtains the mutator for
> a given accessor function by table lookup]
> The key point here is that Scheme already has enough power to express
> the abstract relationship between accessors and mutators; there is no
> need to "extend" the language to provide this feature.
If this is true, then please tell me how you would do the following
using the method you described.
Suppose I want to write a new print function that involves a ``print length''.
The function (print-length) should serve both as an accessor and as a
mutator for the actual print length. That is,
(print-length)
simply returns the current print length, while
(set! (print-length) 20)
should be used to change the print length (changing it would include some
kind of sanity check).
Using the extension to Scheme I outlined in a previous message, the actual
variable holding the print length (say, *print-length*) could be a local
variable to the combined accessor/mutator function:
(define print-length
(let ((*print-length* 100))
(lambda ...
How would you do something like this using the method you proposed
without employing a global variable?
--
Regards,
Oliver Laumann, Technical University of Berlin, Germany.
...!pyramid!tub!net or net@TUB.BITNET