|
Subject: Re: scheme/dsssl question From: Chris Maden <crism@xxxxxxx> Date: Tue, 30 Dec 1997 10:28:07 -0500 |
[Henry Thompson]
> The normal strategy to get around this feature is to use thunks,
> i.e. procedural closures of no arguments:
>
> (define (dblappl fn thunk) (fn (thunk) (thunk)))
>
> (let ((foo 3)) (dblappl + (lambda () foo)))
>
> The thunk of necessity carries its lexical environment with it,
> achieving the encapsulation you need.
>
> Hope this helps
I don't think this helps with Norm's question, where a string or
symbol is passed as an argument to a function which then finds the
value of the object defined with that name.
(define foo
3)
(define bar
... )
such that (bar 'foo) will return 3 or some function thereof. Would
thunks work here?
(define (bar thunk)
(thunk))
or better yet,
(define (bar thunk)
(if (string? thunk)
((string->symbol thunk))
(thunk)))
-Chris
--
<!NOTATION SGML.Geek PUBLIC "-//Anonymous//NOTATION SGML Geek//EN">
<!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN"
"<URL>http://www.oreilly.com/people/staff/crism/ <TEL>+1.617.499.7487
<USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek>
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: scheme/dsssl question, Henry S. Thompson | Thread | scheme/dsssl question, David Megginson |
| Re: Howto change appearance with mo, Norman Walsh | Date | Re: Some XSL Questions, Paul Grosso |
| Month |