[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
possible alternative for use with a corresponding define extension?
- To: <srfi-71@xxxxxxxxxxxxxxxxx>
- Subject: possible alternative for use with a corresponding define extension?
- From: Paul Schlie <schlie@xxxxxxxxxxx>
- Date: Sat, 12 Nov 2005 19:08:50 -0500
- Delivered-to: srfi-71@xxxxxxxxxxxxxxxxx
- Thread-index: AcXn5myTqtlArlPZEdqDZwADk1ictA==
- Thread-topic: possible alternative for use with a corresponding define extension?
- User-agent: Microsoft-Entourage/11.2.1.051004
Out of curiosity, might it be more generally useful to enable the definition
of multiple symbols globally than locally within a let, and support local
function defs within a let which are syntactically similar to that of
define, as an alternative to the presently defined syntax? i.e.:
(define ((x y . z)) ; exported defs.
(let* ([a 1] [b 2] ; not exported.
[(f c . d) (+ a c (car d))]
[(g e) (+ b e (f b 5 6))])
(values f g a b))
(x 2 3 4) => 6 ; (+ 1 2 3)
(y 5) => 18 ; (+ 2 5 (+ 2 5 6))
z => (1 2)
a => <undefined>
b => <undefined>
Thereby enabling a basic simple and consistent means for a module facility,
where ideally newly defined multiple values are limited to within the
current scope and not beyond (thereby if such definitions are loaded
within the context of a let, they are only visible beyond the scope of the
let if explicitly correspondingly effectively exported by a higher level
multiple symbol define:
(define ((x y)) ; defining x y in it's scope.
(load "some-module.ss") ; defining x1 y1 z1 locally.
(let ([x2 x1] [(y2 a b) (y1 (+ a 1) b)]) ; redefining y1.
(values x2 y2))) ; exporting x1 and redefined y1, but not z1
Where then multiple value defs may be enabled within within a let:
(let ([((x y . z)) (values 1 2 3 4)]) (list x y z)) => (1 2 (3 4))
as being correspondingly similar to a multiple value extension of define?
And as an aside, it would seem that a multi-value (list ...) could be used
as effective alternative to (values ...) for the purpose of returning
multiple symbol value definitions?