Sacha,

You can to force evaluation of *indent* while preserving the lazyness  
of the code that uses *indent*:

(with-indent
   (print *indent*)
   (let [ind *indent*]
     (lazy-cons ind (cons ind nil))))

If this idiom is useful often enough there could be a macro for it. Or  
maybe there already is. :-) Rich?

Stuart

> Here is a little test :
>
> (def *indent* 0)
>
> (defmacro with-indent [& body]
>  `(binding [*indent* (+ *indent* 1)]
>     [EMAIL PROTECTED]))
>
> => (with-indent (print *indent*) (lazy-cons *indent* (cons *indent*
> nil)))
> 1(0 0)
>
> I somehow expected to have the special variable value lexically bound
> at evaluation time.
> So I guess this makes perfect sense from the implementor point of
> view. But do we not loose much of the added value of special variables
> this way ? If this is intended, what's the rationale ?
>
> Thanks,
> Sacha
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to