Dave Sann writes:
> Is there an Jira issue for this?
> Is it worth raising one?
I don't follow Clojure development much these days, but I do recall
Rich's Conj keynote a couple years ago mentioning an interest in
"dynamicity knobs" that let you tune space/perf vs feature trade-offs.
But that doe
Thanks Phil.
Is there an Jira issue for this?
Is it worth raising one?
I noted that my requirement is slightly different from yours. I want to
print the function by name (and namespace) only. Serializable-fn prints the
full definition. But this difference is only in print-method - if the
meta-
Getting at the var won't work, but you can get fns to print readably with
their source using https://github.com/technomancy/serializable-fn
Unfortunately you still have the problem that whoever defined it has to opt
in.
Ohil
--
--
You received this message because you are subscribed to the Goo
Hi,
Something like this?
(let [f assoc]
(first
(filter (fn [v] (identical? @v f))
(map second
(mapcat ns-publics (all-ns))
Or even this?
(let [f assoc]
(first
(mapcat #(filter (fn [[ns [sym v]]] (identical? @v f))
%)
(map (
yep, you do have a point
the thing is, that at runtime it's nolonger known that symbol y points to
symbol x, it's only known that y is a function (just like x is, but without
the connection between them), so I really don't see how to actually get the
var of the function that some y points-to eventu
because it is a macro, I am not sure it can work for y. (my macro skills
are limited)
but in the general case where the data is not available at compile time. I
am not sure macros will help.
On Sunday, 3 March 2013 23:44:56 UTC+11, AtKaaZ wrote:
>
> oo, what do we have here?
> => (defmacro get-
oo, what do we have here?
=> (defmacro get-lexical-asvar [q]
(let [
oem (zipmap (keys &env) (vals &env))
zz (.var (.init (second (find oem q
]
`~zz
)
)
#'runtime.q/get-lexical-asvar
=> (let [x assoc
y x]
(str (get-lexical-as
ok you're right, it's impossible to get the var since those x and y are
already resolved to the function, and multiple vars could point to the same
function anyway.
=> (let [x assoc
y x]
(get-lexical-env)
)
{x #, y #}
for consistency, ignore the following:
;the following is insp
that's true but I thought you meant in general
basically, I'm looking for a way to get the var... ie.
=> (let [x assoc
y x]
*(var y)*
)
CompilerException java.lang.RuntimeException: Unable to resolve var: y in
this context, compiling:(NO_SOURCE_PATH:3:3)
=> (let [x assoc
I think, that will only work if you do it directly.
It will not work in the example I gave.
Dave
On Sunday, 3 March 2013 22:43:14 UTC+11, AtKaaZ wrote:
>
>
>
>
> On Sun, Mar 3, 2013 at 12:21 PM, Dave Sann
> > wrote:
>
>> This may be a question for clojure dev
>>
>> I find myself wanting to be
On Sun, Mar 3, 2013 at 12:21 PM, Dave Sann wrote:
> This may be a question for clojure dev
>
> I find myself wanting to be able to print data-structures containing
> resolvable functions
>
> e.g.
>
> (let [x assoc] (str [x :a :b]))
>
> would be:
>
> "[#fn clojure.core/assoc :a :b]"
>
> or simil
11 matches
Mail list logo