Alaric Snell-Pym <[EMAIL PROTECTED]> writes:

AS> He suggested I ask on The List, so here it is. Is there a way to
AS> write parameterize-from-alist without eval hackery, or shall I just
AS> use the wings dynamic environment?

>> 'Course.  However, I'd recommend for it to be implemented as a
>> function, not as a macro.

>> (define (parameterize-from-alist alist thunk)
>>   (let loop ((alist alist))
>>     (if (not (null? alist))
>>         (parameterize ((caar alist) (cdar alist))
>>           (loop (cdr alist)))
>>         (thunk))))

> But (caar alist) will return a symbol, not a parameter object?

       It's up to the caller to supply a correct alist to the function.
       E. g.:

  (parameterize-from-alist (list (cons current-output-port
                                       my-output-port))
                           (lambda ()
                             (display "Hello, world!")
                             (newline)))

       Note that current-output-port evaluates to a parameter object,
       not a symbol.


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to