Subject: Re: scheme/dsssl question From: ht@xxxxxxxxxxxxxxx (Henry S. Thompson) Date: 30 Dec 1997 11:17:36 +0000 |
Chris and Norm ask for eval: It's not a bug that this is missing, it's a feature. Scheme, and a posteriori DSSSL, are lexically scoped. Consider the following (define (dblappl fn var) (fn (eval var) (eval var))) (let ((foo 3)) (dblappl + 'foo)) There is no definition of eval as such which can exhibit coherent behaviour in this case. Some dialects of Scheme support access to lexical binding tables, in which case eval can be defined as a TWO-argument function, but this is implementation-dependent and tacky. 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 ht -- Henry S. Thompson, Human Communication Research Centre, University of Edinburgh 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@xxxxxxxxxxxxxxx URL: http://www.cogsci.ed.ac.uk/~ht/ DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: scheme/dsssl question, Chris Maden | Thread | Re: scheme/dsssl question, Chris Maden |
Re: Some XSL Questions, Sean Mc Grath | Date | List of pairs., Andrei Kaikov |
Month |