Re: Is there a performance hit when dynamically "require"-ing namespaces

2013-01-29 Thread Sean Bowman
s! On Wednesday, January 23, 2013 1:13:29 AM UTC-7, Mikera wrote: > > On Wednesday, 23 January 2013 03:47:56 UTC+8, Sean Bowman wrote: > >> I'm trying to implement a simple system to load certain namespaces into >> my application that are configurable at runtime, via a &

Is there a performance hit when dynamically "require"-ing namespaces

2013-01-22 Thread Sean Bowman
I'm trying to implement a simple system to load certain namespaces into my application that are configurable at runtime, via a "plugins" text file that lists the namespaces we want to load. I have some code that loads this file, then line by line calls "require" dynamically, like so: (doseq [p

Re: Symbols, vars, and namespaces

2012-02-11 Thread Sean Bowman
x))) > ;; initially we use identity > repl-1=> (defn callee [x] x) > > ;; the first form passes the current value of callee; the second > passes the "pointer" > repl-1=> (def passed-value (caller callee)) > repl-1=> (def passed-var (caller #'callee)) > &g

Symbols, vars, and namespaces

2012-02-11 Thread Sean Bowman
I've been working with Compojure and Ring lately to build an app server, and I've gotten my brain stuck trying to figure out wrap- reload. It seems like I have to turn my routes into vars to get wrap- reload to work, but I don't understand why, and I suppose I don't really understand the "when" or

Re: Creating a var, functions from a macro

2011-11-09 Thread Sean Bowman
Apparently the missing bit is I need to "escape" the symbol calls, e.g. (defn ~(symbol "index") ... Is this correct? -- 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 fr

Creating a var, functions from a macro

2011-11-09 Thread Sean Bowman
I've got a few namespaces that use similar functions, but with slight variations. I was thinking of using a macro to generate the repetitive bits of this code, but I'm just not able to get past Cons exceptions and missing symbols. Here's a simple version of what I'm trying to do. Right now, I ha

Reference a function dynamically in a macro?

2011-10-05 Thread Sean Bowman
I like to build DSLs when I code, so that at a high level, much of the logic is readable and consistent. I'm trying to create a macro that will verify the uniqueness of a record based on various fields in the record. For example, if I have a function that looks up a record by its name: (defn

Testing clojure.contrib.condition

2011-04-29 Thread Sean Bowman
Is there any way to test code that uses clojure.contrib.condition to raise meaningful error messages? I've been struggling to write some sort of assert-expr, based on thrown-with-condition?, to check for these errors, but it's obviously way beyond my macro foo at this point. Thoughts, or should I