On Wednesday, February 27, 2013 2:02:36 PM UTC+1, Jim foo.bar wrote:
>
>  The actual code looks like this:
>
> (let [tok-array (into-array ^String token-seq)]
> (map 
>  #((if spans? (fn [span _] span) spans->strings) ;;decide what fn to use
>  (.find this tok-array) tok-array) 
> token-seq) 
>
> As you can see I am sort of creating my own version of identity (fn [span 
> _] span) because I cannot use 'identity' with 2 args. This is my 
> use-case...It should make sense now yes?
>
> Jim
>

Yes, that's it. As I said, I wouldn't want *identity* to do that and find 
it perfectly reasonable to require a special function for this behavior. A 
side note: since *spans?* is a constant within the *map* transform, it 
would pay to decide up-front which function to use:

 (let [f (if spans? (fn [span _] span) spans->strings)]
  (map f (.find this tok-array) tok-array)) 

-- 
-- 
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/groups/opt_out.


Reply via email to