Yeah, for safety's sake I need to macroexpand everything, which wipes out
the &env for internal macros. There might be a gentler way to do this, but
it's not obvious to me. If anyone has suggestions, I'd be interested in
hearing them.
Zach
On Thursday, July 11, 2013 6:35:21 PM UTC-7, Ben wrote:
>
> Note:
>
> proteus> (defmacro aif [test then else]
> (let [it (first (filter #(not (contains? &env %))
> (cons 'it (map #(symbol (str "it-" %))
> (iterate inc 1)))))]
> `(let [~it ~test] (if ~it ~then ~else))))
> #'proteus/aif
> proteus> (aif (get {:x {:y 3}} :x)
> (aif (get it :y)
> [it it-1]
> it)
> nil)
> [{:y 3} 3]
> proteus> (let-mutable [x 1]
> (aif (get {:x {:y 3}} :x)
> (aif (get it :y)
> (set! x [it it-1])
> (set! x it))
> (set! x nil))
> x)
> CompilerException java.lang.RuntimeException: Unable to resolve symbol:
> it-1 in this context, compiling:(NO_SOURCE_PATH:1:1)
> proteus>
>
>
>
>
> On Thu, Jul 11, 2013 at 6:16 PM, Zach Tellman <[email protected]<javascript:>
> > wrote:
>
>> There was some discussion a few days ago about how the lack of local
>> mutable variables were harming performance, or possibly elegance, I'm not
>> sure. Regardless, I fixed it: https://github.com/ztellman/proteus
>>
>> Enjoy!
>>
>> --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to [email protected]<javascript:>
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
>
> --
> Ben Wolfson
> "Human kind has used its intelligence to vary the flavour of drinks, which
> may be sweet, aromatic, fermented or spirit-based. ... Family and social
> life also offer numerous other occasions to consume drinks for pleasure."
> [Larousse, "Drink" entry]
>
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.