You use this-as:

(this-as thisname
  (whatever thisname))

where you name this what you want with thisname

Cheers


On Fri, Jan 25, 2013 at 1:46 PM, Ari <ari.brandeis.k...@gmail.com> wrote:

> Additionally, ".each()" is another option --
>
> (defn listen-to-links
>   [links]
>   (.each links
>          (fn [idx, el]
>            (.log js/console el))))
>
> However, how does one reference "this" within the anonymous (or defined)
> function?
>
> On Wednesday, January 23, 2013 11:45:13 PM UTC-5, Evan Mezeske wrote:
>>
>> Oops, I should never type code straight into an email window, without
>> REPLing it first...  X_X
>>
>> I left in the "links" argument to map.  This is probably closer to what I
>> meant:
>>
>> (defn listen-to
>>   [links]
>>   (doseq [link links]
>>     (.log js/console link)))
>>
>> On Wednesday, January 23, 2013 8:39:51 PM UTC-8, Evan Mezeske wrote:
>>>
>>> When you want to iterate over things and perform a side-effecty action
>>> for each one (logging is a side effect, as would be adding event listeners
>>> to DOM nodes, changing CSS classes, etc), doseq is usually the clearest
>>> thing to do:
>>>
>>> (defn listen-to
>>>   [links]
>>>   (doseq [link links]
>>>     (.log js/console link) links))
>>>
>>> You almost never want to use map for side effects.  A good rule of thumb
>>> is that if you don't use the return value from map, you probably want doseq
>>> instead.
>>>
>>  --
> --
> 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
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Reply via email to