2

I'd like to add certain library dependencies to LightTable as a whole so that when I am messing around learning new stuff, I don't have to create a new project as a whole.

Let's say I want to always have access to these libraries: math.combinatorics and math.numeric-tower.

Lighttable seems to be calling a repl from leinigen, so am I really needing to add something there?

See https://github.com/LightTable/LightTable/blob/master/project.clj

dmbennett
  • 109
  • 1
  • 8

2 Answers2

1

It will be calling a repl of Leiningen. Rather than adding the dependencies to LightTable you could add them to your Leiningen Profile (~/.lein/profiles.clj) The file would probably look something like this with your dependencies:

{:user {:dependencies [[math.combinatorics "x.x.x"]
                       [math.numeric-tower "x.x.x"]]}}

Generally this is not a very good idea. It will be a global thing and will probably cause you problems in the future. If you create an application you might find that these two libraries are available when they won't be for other people or on difference computers.

What would be a better option would be to create a new project using Leiningen. You can then edit your project.clj file to look something like this

(defproject math-thing "0.1.0-SNAPSHOT"
   :description "FIXME: write description"
   :dependencies [[org.clojure/clojure "1.6.0"]
                  [math.combinatorics  "x.x.x"]
                  [math.numeric-tower  "x.x.x"]])

Then when editing your clj file LightTable uses your project.clj file to start instrepl and will resolve any needed dependencies.

Hugo
  • 710
  • 1
  • 10
  • 19
  • 1
    It looks like you meant to say "Generally this is **not** a very good idea" ? – David Oct 14 '14 at 14:28
  • @firthh I can't seem to find and edit the (~/.lein/profiles.clj) When I look for this directory I find it, however--currently--no profile.clj file lives there. I have installed lein using homebrew. – dmbennett Oct 14 '14 at 17:32
  • I'd like to add that I am using Clojure 1.6.0 and Leiningen 2.4.1. – dmbennett Oct 14 '14 at 17:39
  • 1
    Yes @David that is what I meant. @dmbennett you should just be able to create that file if it doesn't exist. You're better off using Leiningen to create a new project for you and adding the dependencies in there. The `lein new` command makes it really easy to create a new project – Hugo Oct 15 '14 at 15:43
0

Use the leiningen profile e.g. ~/.lein/profiles.clj and define a :injections [ ... ] node which performs the (require '[ ]) and import, refer-clojure and other items you have. I generally prefer to have at least Alembic present in my dev profile (wrapping Maven/Sonatype) so I can download, install in maven then classpath and project reload in one go using a macro/function wrapper around distill* to prevent a long load time due to too many libraries included in the user space. Pretty much this is the only function I usually want present in any REPL or LT InstaRepl and I put development and debugging snippets in project ./dev/user.clj to keep most of the messy stuff project specific.

Rob Jens
  • 584
  • 6
  • 8