Hello,
Currently when you have a reflection warning in a -> form, you have to
split it:
clojure.core=> (-> "hello world" (.split " ") second (.split "o") seq)
Reflection warning, line: 1269 - call to split can't be resolved.
("w" "rld")
I propose to modify the -> macro to make it preserve type hints, hence
you could write:
clojure.core=> (-> "hello world" (.split " ") #^String second (.split
"o") seq)
("w" "rld")
Here is the patched macro:
(defmacro ->
"Threads the expr through the forms. Inserts x as the
second item in the first form, making a list of it if it is not a
list already. If there are more forms, inserts the first form as the
second item in second form, etc."
([x] x)
([x form] (with-meta
(if (seq? form)
`(~(first form) ~x ~@(next form))
(list form x)) (meta form)))
([x form & more] `(-> (-> ~x ~form) ~...@more)))
--
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (en)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---