Re: Access function argument from outer anonymous function

2010-07-22 Thread Meikel Brandmeyer
Hi,

On Jul 22, 10:36 am, Paul Richards  wrote:

> When I nest these however:

#() cannot be nested.

Sincerely
Meikel

-- 
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


Re: Access function argument from outer anonymous function

2010-07-22 Thread B Smith-Mannschott
On Thu, Jul 22, 2010 at 10:36, Paul Richards  wrote:
> When I use the reader macro for anonymous functions I can use "%" to
> access the function argument:
>
> #(... % ...)
>
> This is great.  When I nest these however:
>
> #(.. #(.. % ..) )
>
> Is there a way to access the function argument for the outer anonymous
> function from inside the inner one?
>
> E.g, it would be handy if "%" was rebound to "%%" (or some other magic).
>
> At the moment I've had to convert my outer anonymous function to use
> (fn [x] ..) style to allow me to use "%" and "x" inside the inner
> anonymous function.

That's the way to go. Or are you intentionally trying to make your code cryptic?

// Ben

-- 
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


Access function argument from outer anonymous function

2010-07-22 Thread Paul Richards
When I use the reader macro for anonymous functions I can use "%" to
access the function argument:

#(... % ...)

This is great.  When I nest these however:

#(.. #(.. % ..) )

Is there a way to access the function argument for the outer anonymous
function from inside the inner one?

E.g, it would be handy if "%" was rebound to "%%" (or some other magic).

At the moment I've had to convert my outer anonymous function to use
(fn [x] ..) style to allow me to use "%" and "x" inside the inner
anonymous function.


-- 
Paul Richards
@pauldoo

-- 
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