Re: avoiding repetition in ns declarations

2014-01-24 Thread Konrad Hinsen
--On 24 Jan 2014 00:58:46 -0800 Mark Engelberg wrote: I thought clj-nstools was for Clojure 1.2 only.  Not true? I have used it with Clojure 1.3 without modifications. I haven't done any major Clojure project with later Clojure releases, so I don't if it works with a current setup. It should

Re: avoiding repetition in ns declarations

2014-01-24 Thread Phillip Lord
Konrad Hinsen writes: > --On 23 janvier 2014 13:08:57 + Phillip Lord > wrote: > >>> The nstools library lets you do exactly that: >>> >>> https://code.google.com/p/clj-nstools/ >> >> That looks nice; why not open up the reference-map though, so that it >> would become extensible. > > That'

Re: avoiding repetition in ns declarations

2014-01-24 Thread Mark Engelberg
I thought clj-nstools was for Clojure 1.2 only. Not true? On Thu, Jan 23, 2014 at 1:07 AM, Konrad Hinsen < googlegro...@khinsen.fastmail.net> wrote: > --On 21 janvier 2014 23:15:50 -0800 t x wrote: > >I have the following problem: >> >> (ns foo.bar >> ... >> ... >> ... ) >> >> There'

Re: avoiding repetition in ns declarations

2014-01-24 Thread Konrad Hinsen
--On 23 janvier 2014 13:08:57 + Phillip Lord wrote: The nstools library lets you do exactly that: https://code.google.com/p/clj-nstools/ That looks nice; why not open up the reference-map though, so that it would become extensible. That's a good idea. Just making it public is risky,

Re: avoiding repetition in ns declarations

2014-01-23 Thread Phillip Lord
Konrad Hinsen writes: >>   I have the following problem: >> >> (ns foo.bar >>   ... >>   ... >>   ... ) >> >> There's basically 10 lines of require that I want as part of nearly >> _every_ ns I declare is there a way to define some soft of alias / >> abbrevraviation that is used in namespaces at w

Re: avoiding repetition in ns declarations

2014-01-23 Thread Phillip Lord
t x writes: > Staurt, Phillip: > > Correct me if I'm wrong, the main idea recommended is: > > (1) don't try to do it via (:require ...) inside of (ns ... ) > (2) define a function, which calls (require ... ) [i.e. the function, > outside of (ns ... )] > > Thus, the end solution ends up being: > >

Re: avoiding repetition in ns declarations

2014-01-23 Thread Konrad Hinsen
--On 21 janvier 2014 23:15:50 -0800 t x wrote:   I have the following problem: (ns foo.bar   ...   ...   ... ) There's basically 10 lines of require that I want as part of nearly _every_ ns I declare is there a way to define some soft of alias / abbrevraviation that is used in namespaces at w

Re: avoiding repetition in ns declarations

2014-01-22 Thread Cedric Greevey
Maybe there should be a way to export stuff for transitive inclusion: (ns common-includes (:require [foo.core :refer [fooify] :export true]) ...) ... (ns my-ns (:require [common-includes :as c])) (defn bar [x] (c/fooify x 42)) On Wed, Jan 22, 2014 at 4:22 PM, Stuart Sierra wrote: >

Re: avoiding repetition in ns declarations

2014-01-22 Thread Stuart Sierra
On Wed, Jan 22, 2014 at 3:19 PM, t x wrote: > (defn load-standard-requires [] > (require ... ) > (require ... )) ... > Can either of you confirm this is the main plan of attack you have > suggested? > I don't actually *recommend* doing this. But it will work. My recommendation is to just

Re: avoiding repetition in ns declarations

2014-01-22 Thread t x
Staurt, Phillip: Correct me if I'm wrong, the main idea recommended is: (1) don't try to do it via (:require ...) inside of (ns ... ) (2) define a function, which calls (require ... ) [i.e. the function, outside of (ns ... )] Thus, the end solution ends up being: magic.cljx (defn load-standard

Re: avoiding repetition in ns declarations

2014-01-22 Thread Michał Marczyk
Not addressing the main problem, but require takes multiple libspecs, so you can write (ns foo (:require [foo.bar :as bar] [foo.quux :as quux])) to avoid repeating the keyword, at least. :require in ns expands to a call to require-the-function, so the latter supports multiple

Re: avoiding repetition in ns declarations

2014-01-22 Thread Phillip Lord
t x writes: > (ns foo.bar > ... > ... > ... ) > > There's basically 10 lines of require that I want as part of nearly _every_ > ns I declare is there a way to define some soft of alias / abbrevraviation > that is used in namespaces at will? > > For example: > > ## somewhere, in a magic file:

Re: avoiding repetition in ns declarations

2014-01-22 Thread Stuart Sierra
There's nothing built in to Clojure that does this, but you can easily define a function in one namespace that calls `require` for your other namespaces. Note that this may reduce readability of your source code if you forget exactly which namespaces that special function loads. -S -- -- Y

Re: avoiding repetition in ns declarations

2014-01-21 Thread guns
On Tue 21 Jan 2014 at 11:15:50PM -0800, t x wrote: > Hi, > > I have the following problem: > > (ns foo.bar > ... > ... > ... ) > > There's basically 10 lines of require that I want as part of nearly _every_ > ns I declare is there a way to define some soft of alias / abbrevraviation > that