http://dev.clojure.org/jira/browse/CLJ-731 ?

On Tue, Oct 28, 2014 at 2:39 AM, Phillip Lord <phillip.l...@newcastle.ac.uk>
wrote:

> Reid McKenzie <rmckenzi...@gmail.com> writes:
> > This suggests that |apply| is immensely expensive in general,
> > and that such arity unrolling even for trivial functions would be a good
> > thing. Albeit hard to build.
>
>
> Wonder whether it is macroable. Something like
>
>
> (def new-function
>   (with-arities [20]
>      [args]
>      (blah args)
>      [args & rest]
>      (apply args rest)))
>
>
> which gets replaced with
>
>   (fn
>     ([]
>      (blah))
>     ([a]
>      (blah a))
>     ;;...etc
>     ([a...t]
>      (blah a...t))
>     ([a...t & rest]
>      (apply blah a...t rest)))
>
>
> Where a...t are the symbols a to t. Would this help? The function blah,
> of course, would know what it's arity is, but this is true for most
> higher-order functions (if functions returned their arities, I guess you
> could work around this, but they don't).
>
> So, partial would become something like...
>
> (def partial
>   (with-arities [:all]
>     [args]
>     (fn [args] (args))
>     [args & rest]
>     (fn [& rst] (apply (list* args rst)))))
>
>
> Just thinking aloud!
>
> Phil
>
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to