.> macro now supports both .accessors and :accessor callsdelegate added for better object supportChanged syntax:
.$ to .> (threading macro).> to .%> (display class hierachy).% (display class info).?, .% and .%> works both on classes and instancesAdd to project.clj dependencies:
[im.chit/iroh "0.1.9"]
For working in the repl or emacs, inject the core functionality into your clojure.core namespace using vinyasa by adding the following to your ~/.lein/profiles.clj file:
{:user {:dependencies [[im.chit/iroh "0.1.8"] [im.chit/vinyasa "0.2.0"]] :injections [(require 'vinyasa.inject) .... (vinyasa.inject/inject 'clojure.core '[[iroh.core delegate >ns >var .> .? .* .% .%>]]) ....]}}
delegate - Transparent BeanDelegate does what bean does but it actually allows field access to the underlying object. This way, one can set and get values from the object :
(def a "hello") a ;;=> "hello" (def >a (delegate a)) >a ;;=> <java.lang.String@99162322 {:hash 99162322, :hash32 0, :value #<char[] [C@202cf33f>}> @>a ;;=> {:hash 99162322, :hash32 0, :value #<char[] [C@202cf33f>} (keys >a) ;;=> (:value :hash :hash32) (>a :hash) ;;=> 99162322 (:hash32 >a) ;;=> 0 (>a :value (char-array "world")) ;;=> "world" a ;;=> "world" (But I thought string where immutable!)
.> - ThreadingA shorthand way of accessing private field is done by using .>:
(def a "hello") (.> a :value) ;=> #<char[] [C@753f827a> (.> a (:value (char-array "world"))) a ;;=> "world"