Ok, got it. It was an oversight on my part. From a config file, I was
pulling in *myns/myfn*. But this is just a symbol. I needed to resolve it,
and deref the var that it pointed to. So now the below works. Tricky, but I
should have caught it earlier.

(apply @(resolve *afn*) params)




Thanks guys :)

Tim Washington
Interruptsoftware.com <http://interruptsoftware.com>


On Fri, Jan 3, 2014 at 8:48 PM, Timothy Washington <twash...@gmail.com>wrote:

> Yes, good point. I tried apply, but the result from that is always 
> *nil*(where there should be a value). You're right that it should work (we
> wouldn't use eval in that scenario), but it doesn't.
>
> I tried putting params in a seq a list and a vector, but no dice. I'm
> still playing around with it.
>
>
> Tim Washington
> Interruptsoftware.com <http://interruptsoftware.com>
>
>
> On Fri, Jan 3, 2014 at 8:19 PM, Cedric Greevey <cgree...@gmail.com> wrote:
>
>> Yeah, he probably could. But maybe he has a good reason for avoiding it
>> that we're not aware of. Though I'm not sure what that could be.
>>
>>
>> On Fri, Jan 3, 2014 at 8:11 PM, Jason Wolfe <ja...@w01fe.com> wrote:
>>
>>>
>>>
>>>
>>> On Fri, Jan 3, 2014 at 4:43 PM, Timothy Washington 
>>> <twash...@gmail.com>wrote:
>>>
>>>> The crux of the problem is that the size of *params* can be variable.
>>>> Only at runtime, does the code match the loaded *afn*, with the passed
>>>> in *params*. So I basically just need to break out the *~@params* into
>>>> individuated input arguments. The only other way I can think to do that,
>>>> without using eval, would be to curry afn, for each input param.
>>>>
>>>
>>> Can you just use `apply`?
>>>
>>>
>>>>
>>>>
>>>> Tim Washington
>>>> Interruptsoftware.com <http://interruptsoftware.com>
>>>>
>>>>
>>>> On Fri, Jan 3, 2014 at 7:20 PM, Jason Wolfe <ja...@w01fe.com> wrote:
>>>>
>>>>> Glad to help.
>>>>>
>>>>> I admittedly haven't taken the time to understand what's going on in
>>>>> your code, but whenever I see `eval` I feel compelled to ask: are you sure
>>>>> you need it?
>>>>>
>>>>> With that out of the way, here's a trick I've used to work around
>>>>> related errors:
>>>>>
>>>>> https://groups.google.com/d/msg/clojure/BZwinR2zNgU/8HGOgzOxzosJ
>>>>>
>>>>> Best,
>>>>> Jason
>>>>>
>>>>> On Friday, January 3, 2014 3:18:22 PM UTC-8, frye wrote:
>>>>>
>>>>>> Hey Jason,
>>>>>>
>>>>>> You were exactly right (which is pretty impressive, being that you've
>>>>>> never seen my code). In my (s/defn ..) form, there was an error that was
>>>>>> failing silently.
>>>>>>
>>>>>> (s/defn [one two]
>>>>>>    ...
>>>>>>    *#_(def params (atom '({}) ))*
>>>>>>    (def params '({}))
>>>>>>    (try (eval `(~afn ~@params))  (catch Exception e (println
>>>>>> "Exception: " (.getMessage e)))))
>>>>>>
>>>>>>
>>>>>> So the abouve code works. But if I instead use the commented version,
>>>>>> I'll get an exception. It seems there's a problem passing in a form
>>>>>> containing an atom to be dynamically eval'd. The error is mentioned on
>>>>>> these posts (here <http://clojure-log.n01se.net/date/2009-03-02.html>and
>>>>>> here<http://www.raynes.me/logs/irc.freenode.net/clojure/2012-09-17.txt#>).
>>>>>> Is there a way to pass in a form containing an atom to be dynamically
>>>>>> eval'd? It's pretty important to my architecture, that all functions 
>>>>>> treat
>>>>>> that system-atom the same. Any insights are welcome.
>>>>>>
>>>>>> *"java.lang.RuntimeException: Can't embed object in code, maybe
>>>>>> print-dup not defined: clojure.lang.Atom@1c99db7 (NO_SOURCE_FILE:0)"*
>>>>>>
>>>>>>
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Tim Washington
>>>>>> Interruptsoftware.com <http://interruptsoftware.com>
>>>>>>
>>>>>>
>>>>>>

-- 
-- 
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