How to save gorilla plots to file
Hi all, I have found the gorilla REPL (http://gorilla-repl.org/) very useful for data analysis in clojure. One of the great benefits is that it can display plots in-line (based on vega). When saving such notebook, these plots are represented as base64 text strings in the .clj file. However, I have not been able so save these images separately as e.g. PNG files. Does anyone know how to save a plot from a gorilla repl into a file? Many thanks, jan. -- 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/d/optout.
Re: How to save gorilla plots to file
I've found a workaround now. I use the incanter library to create the plots, which allows me to do a (save my-plot "file.png"). To display the same plot on the screen: (chart-view my-plot). j. On Saturday, January 16, 2016 at 7:20:25 PM UTC+1, jandot wrote: > > Hi all, > > I have found the gorilla REPL (http://gorilla-repl.org/) very useful for > data analysis in clojure. One of the great benefits is that it can display > plots in-line (based on vega). When saving such notebook, these plots are > represented as base64 text strings in the .clj file. However, I have not > been able so save these images separately as e.g. PNG files. > > Does anyone know how to save a plot from a gorilla repl into a file? > > Many thanks, > jan. > -- 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/d/optout.
Re: How to save gorilla plots to file
Nice :-) On Sunday, January 17, 2016 at 10:00:38 PM UTC+1, Jony Hudson wrote: > > Nice. In case you're not already familiar with it, this ( > https://github.com/JonyEpsilon/gg4clj) might be useful as well if you > want to be able to make more complex plots. > > > Jony > > On Saturday, 16 January 2016 18:20:25 UTC, jandot wrote: >> >> Hi all, >> >> I have found the gorilla REPL (http://gorilla-repl.org/) very useful for >> data analysis in clojure. One of the great benefits is that it can display >> plots in-line (based on vega). When saving such notebook, these plots are >> represented as base64 text strings in the .clj file. However, I have not >> been able so save these images separately as e.g. PNG files. >> >> Does anyone know how to save a plot from a gorilla repl into a file? >> >> Many thanks, >> jan. >> > -- 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/d/optout.
bioinformatics toolkit in clojure: what would that look like?
Hi all, I have been a ruby user for several years and have contributed to the bioruby toolkit for bioinformatics. Lately however I got interested in clojure as it's a functional language and should be very good for working with the huge datasets we have to handle. Although there are bioinformatics toolkits for many OO languages (biojava, bioperl, biopython and bioruby), nothing similar exists for clojure yet. And I'd be interested to start building such toolkit while I learn the language. At first for my own use, but maybe later... who knows. Being new to functional languages, I wonder how such a toolkit would be best approached. In an OO language you create classes with properties and methods that describe one particular entitiy in the field. For example: you define a DNASequence class with a "name" and "sequence" property, and a method to print it out in an international standard text format, and another method for translating the DNA sequence in that of the resulting protein. Much of the functionality of these toolkits is about retrieving a bit of information, manipulating it and ultimately writing it to screen/file. As functional languages are more about verbs than nouns: how could a bioinformatics toolkit be idiomatically set up? Would it still be the Right Way (TM) to create some type of classes, a-la OO? For more information on the OO toolkits, see www.bioperl.org, www.biojava.org, bioruby.org and biopython.org. As clojure (especially combined with incanter) seems to be a very good candidate for future work in bioinformatics, I would very much welcome a little discussion on this. Many thanks, jan. -- 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
Re: bioinformatics toolkit in clojure: what would that look like?
Bonjour Nicolas, I've started using clojure for my bioinformatics work, but it is still *very* early days. Will try to become more proficient in it, but slowly building up a toolkit for myself might just be the seed for bioclojure. Have no idea to what extent clojure is used at the moment in the field. Will have a look at protocols and defrecord. Will keep you informed if/ when I think I can take it further. jan. On Jun 28, 7:22 pm, Nicolas Oury wrote: > Hi, > > I am using Clojure for bioinformatics, but not the same kind of stuff. > I am writing a stochastic simulator. > > Would love to discuss more about your idea though. > > You can have something quite close to what you describe as the OO approach > with > protocols and data-types. > + by using defrecord, you can easily have generic functions. > > That would the easier approach, I think. > > I will have a look to bio*. > > But if you want to start a project, count me in. > > > > On Sun, Jun 27, 2010 at 11:15 PM, jandot wrote: > > Hi all, > > > I have been a ruby user for several years and have contributed to the > > bioruby toolkit for bioinformatics. Lately however I got interested in > > clojure as it's a functional language and should be very good for > > working with the huge datasets we have to handle. > > > Although there are bioinformatics toolkits for many OO languages > > (biojava, bioperl, biopython and bioruby), nothing similar exists for > > clojure yet. And I'd be interested to start building such toolkit > > while I learn the language. At first for my own use, but maybe > > later... who knows. > > > Being new to functional languages, I wonder how such a toolkit would > > be best approached. In an OO language you create classes with > > properties and methods that describe one particular entitiy in the > > field. For example: you define a DNASequence class with a "name" and > > "sequence" property, and a method to print it out in an international > > standard text format, and another method for translating the DNA > > sequence in that of the resulting protein. Much of the functionality > > of these toolkits is about retrieving a bit of information, > > manipulating it and ultimately writing it to screen/file. > > > As functional languages are more about verbs than nouns: how could a > > bioinformatics toolkit be idiomatically set up? Would it still be the > > Right Way (TM) to create some type of classes, a-la OO? > > > For more information on the OO toolkits, seewww.bioperl.org, > >www.biojava.org, > > bioruby.org and biopython.org. > > > As clojure (especially combined with incanter) seems to be a very good > > candidate for future work in bioinformatics, I would very much welcome > > a little discussion on this. > > > Many thanks, > > jan. > > > -- > > 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 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
Re: Clojure-based scientific paper!
Congratulations Boris. Nice to see clojure being used in bioinformatics :-) I might get in touch with you later about building a clojure library for bioinformatics... jan. On Jul 14, 7:56 am, bOR_ wrote: > Hi all, > > My first paper with results based on a clojure-build agent-based model > is in press! If you have academic access to the journal, you can peek > at it here:http://dx.doi.org/10.1016/j.epidem.2010.05.003, but > otherwise it is also available on mendeley: > http://www.mendeley.com/profiles/boris-schmid/ > > A very old and experimental version of the code is still in the files > directory of the newsgroup (eden.clj), but I'll make some time to > clean up the current version and drop it in the files directory as > well. > > Several other papers using clojure are in the works as well, and by > now I'm making heavy use of Incanter for visualization. Thanks for > making these wonderful tools! The paper quoted above still uses > xmgrace and inkscape. -- 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
clojure-contrib replace-first-str
Hi, I'm using replace-str and replace-first-str (from clojure-contrib 1.2.0-beta1), and it seems that these do not have the same functionality contrary to their descriptions.The following code will work with the regular (replace-str), but (replace-first-str) returns an error: user=> (replace-str "a" "f" "abcabc") "fbcfbc" user=> (replace-first-str "a" "f" "abcabc") java.lang.ClassCastException: java.lang.String cannot be cast to java.util.regex.Pattern (NO_SOURCE_FILE:0) Is this the expected behaviour? jan. -- 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
Re: clojure-contrib replace-first-str
Thanks Stuart. Got it working now. jan. On Jul 21, 2:28 pm, Stuart Halloway wrote: > Hi Jan, > > These functions in contrib are deprecated (and will be marked so as soon as > we have time to make a pass through contrib). > > Please use the functions in clojure.string. > > Stuart Halloway > Clojure/corehttp://clojure.com > > > > > Hi, > > > I'm using replace-str and replace-first-str (from clojure-contrib > > 1.2.0-beta1), and it seems that these do not have the same > > functionality contrary to their descriptions.The following code will > > work with the regular (replace-str), but (replace-first-str) returns > > an error: > > > user=> (replace-str "a" "f" "abcabc") > > "fbcfbc" > > user=> (replace-first-str "a" "f" "abcabc") > > java.lang.ClassCastException: java.lang.String cannot be cast to > > java.util.regex.Pattern (NO_SOURCE_FILE:0) > > > Is this the expected behaviour? > > > jan. > > > -- > > 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 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
setting classpath and using namespace: how to enable example scripts in library?
Hi all, I'm writing a library which is organized using "lein new", so the directory structure contains an "src" and "test". I have added a directory "examples" with scripts that should be able to run by just typing "./example-1.clj". So the directory structure is: +- project.clj +- src |+- my-project |+- core.clj |+- io.clj |+- conversions.clj +- test +- examples +- example-1.clj +- example-2.clj Suppose that src/my-project/core.clj has the following contents: (ns my-project.core) (defn print-hello [] "Hello world") I can run that code from the repl (in my case: using liebke's "cljr repl") with: (load-file "core.clj") (print-hello) However, I have not been able yet to create the example script that should be executable by itself. What should that file look like? There are basically 2 issues: the she-bang line and the namespace. I've tried using different versions of "/usr/bin/env cljr run" and "/usr/ bin/env java -cp cljr.jar ..." in the she-bang line, but no luck. Same goes for loading the my-project source files. It'll be obvious to you that I don't know java :-) Should be simple, but Many thanks, jan. -- 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
Re: setting classpath and using namespace: how to enable example scripts in library?
Thank you Nikita. This looks very much what I need; I now have it running using your first example. jan. On Aug 2, 7:54 am, Nikita Beloglazov wrote: > I don't know how my example fits your needs, but I use something like: > > # /bin/sh > java -cp "lib/*":"src" clojure.main -e "(require 'my-project.core) > (my-project.core/print-hello)" > > assuming, that in lib all neccesary libs are placed (clojure.jar, > clojure-contrib.jar, etc) > To download needed libs in lib directory I use "lein deps" > If you want to run examples then you can use > # /bin/sh > java -cp "lib/*":"examples" clojure.main -e "(require 'example-1) > (example-1/print-hello)" > > Note that if you use namespaces with dashes (e.g. example-1), file should > have name example_1.clj (replace dashes with underscores) > > You can also make java class with main method and compile and execute it. > How to do it described here:http://clojure.org/compilation > > Regards, > Nikita Beloglazov > > > > On Mon, Aug 2, 2010 at 12:09 AM, jandot wrote: > > Hi all, > > > I'm writing a library which is organized using "lein new", so the > > directory structure contains an "src" and "test". I have added a > > directory "examples" with scripts that should be able to run by just > > typing "./example-1.clj". > > > So the directory structure is: > > > > +- project.clj > > +- src > > | +- my-project > > | +- core.clj > > | +- io.clj > > | +- conversions.clj > > +- test > > +- examples > > +- example-1.clj > > +- example-2.clj > > > > > Suppose that src/my-project/core.clj has the following contents: > > (ns my-project.core) > > (defn print-hello [] "Hello world") > > > I can run that code from the repl (in my case: using liebke's "cljr > > repl") with: > > (load-file "core.clj") > > (print-hello) > > > However, I have not been able yet to create the example script that > > should be executable by itself. What should that file look like? There > > are basically 2 issues: the she-bang line and the namespace. I've > > tried using different versions of "/usr/bin/env cljr run" and "/usr/ > > bin/env java -cp cljr.jar ..." in the she-bang line, but no luck. Same > > goes for loading the my-project source files. > > > It'll be obvious to you that I don't know java :-) Should be simple, > > but > > > Many thanks, > > jan. > > > -- > > 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 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
cljr-record: what's the idiomatic way to create API to database?
Hi all, I'd like to build a clojure api to a mysql database. Have done this previously using ruby's ActiveRecord which makes this very easy. clj- record apparently provides the same kind of functionality. The clj-record README shows how to create an interface to a table (let's say "employees") with: (ns our-warehouse.employee (:require clj-record.boot)) (def db ...a clojure.contrib.sql db-spec...) (clj-record.core/init-model) As you see, the connection to the database is made within a namespace that is specific to one particular table. Is there an idiomatic way to: - create the connection first (namespace would be for *database* rather than *table*, so "our-warehouse* in the example above instead of "our-warehouse.employee") - create and initialize all the clj-record functions within that namespace? As there are a lot of tables (but the code for connecting to each very short): is it possible to do all those definitions in the same file? Or am I thinking too much using my ruby background? A small ruby example for 2 classes: ActiveRecord::Base.establish_connection( :adapter => "mysql", :host => "localhost", :username => "myuser", :password => "mypass", :database => "somedatabase" ) class Employee < ActiveRecord::Base belongs_to :company end class Company < ActiveRecord::Base has_many :employees end Any help/direction appreciated. Thanks, jan. -- 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
trouble getting library structure right: can't let files talk to each other
Hi all, I'm trying to write a library to perform some statistical and data mining analyses. Clojure has proven a great help here, especially with the incanter library. Writing the code has been kind of an "organic" process (read: no planning), and I ended up with different conceptual groups of functions all within one file. So it makes sense to split this up and start organizing it. Unfortunately, I am having trouble making the different files (and namespaces) talk to each other, and need some help. Let's say I have two parts in my analysis, each of which require quite a few underlying functions. I would ideally start up a repl and focus on just one analysis: playing with the data, making some graphs, ... I've created a leiningen project with "lein new my-important-project", to which I added two files in src: analysis-1.clj and analysis-2.clj. Directory structure: +- project.clj +- test | +- my-important-project | +- core.clj +- src +- my-important-project +- core.clj +- analysis-1.clj +- analysis-2.clj Let's say this is the contents for those 3 files in src/ (core.clj contains functions and constants that are necessary for both analyses): core.clj (ns my-important-project.core (:use [incanter core io stats charts] [somnium congomongo])) (mongo! :db "the-database") (def some-constant 3.141592) analysis-1.clj (ns my-important-project.analysis-1) (defn say-from-one [text] (println (str "from 1: " text))) analysis-2.clj (ns my-important-project.analysis-2) (defn say-from-two [text] (println (str "from 2: " text))) If I want to work on analysis 2, I'd start up the repl in the main directory created by lein (so one *up* from src) and type: user=> (ns '(my-important-project core analysis-2)) user=> (say-from-two "some text") But as you'd have guessed: this doesn't work. The (ns) returns the following error: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IObj (core.clj:1) I've tried different versions of the (ns) function, including a vector as its argument, periods instead of spaces, ... In addition: in the end I'd like to write a script that does the analysis automatically. So instead of going into the repl, I'd "cljr run" a clj file. What should the (ns) bit of that file look like? I've been searching the web for what I'm doing wrong, but haven't found the solution yet. It's quite frustrating to see so many discussions about namespaces, but not being able to solve this issue. Any help very much appreciated, jan. -- 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
Re: trouble getting library structure right: can't let files talk to each other
Thanks Rasmus, Meikel, This does help a lot already. There still seems to be an issue with using some of the things, though. When I do (require '(my-important-project core analysis-2)) I would logically do (in-ns 'my-important-project.analysis-2) because that's where all the functions are that I actually have to call. I am then still able to print out the some-constant from core by (println my-important-project.core/some-constant) but it seems that this does not work for the congomongo connection to a mongodb database (also referred to in the core.clj file): (println (my-important-project.core/fetch-one :data)) ; => No such var: my-important-project.core/fetch-one For this to work I have to reference the underlying "somnium.congomongo" directly instead of my-important-project.core: (println (somnium.congomongo/fetch-one :data)) ; => works Is there a way to make "fetch-one" and "some-constant" available within the analysis-2 namespace using their unqualified names? What about defining the namespace at the top of the analysis-2.clj file like this? (ns my-important-project.analysis-2 (:use [my-important-project core])) and just saying (require '(my-important-project analysis-2)) in the repl (so without mentioning core)? This *does* make it possible to get to "some-constant" directly, but still no luck with the congomongo (fetch-one) function. I don't understand why... If congomongo is "used" within core and core is "used" within analysis-2, this does not mean that the congomongo functions are available in analysis-2 without explicit calling of congomongo? That would be unfortunate, because I'd have to start "using" congomongo in several places, as well as incanter and other libraries... jan. On Aug 17, 1:10 pm, Meikel Brandmeyer wrote: > Hi, > > On 17 Aug., 13:39, Rasmus Svensson wrote: > > > (in-ns 'my-important-project.analysis-2) > > > or simply use the ns macro: > > > (ns my-important-project.analysis-2) > > Please note, that these two are *not* equivalent! > > With ns: > > Clojure 1.1.0 > user=> (ns foo.bar (:refer-clojure :exclude (map))) > nil > foo.bar=> (def map 5) > #'foo.bar/map > foo.bar=> (in-ns 'user) > # > user=> (ns foo.bar) > java.lang.IllegalStateException: map already refers to: #'foo.bar/map > in namespace: foo.bar (NO_SOURCE_FILE:4) > > With in-ns: > Clojure 1.1.0 > user=> (ns foo.bar (:refer-clojure :exclude (map))) > nil > foo.bar=> (def map 5) > #'foo.bar/map > foo.bar=> (in-ns 'user) > # > user=> (in-ns 'foo.bar) > # > > ns should really only be used to define a namespace. Then you should > use in-ns to switch namespaces in the Repl (or to ensure we are in the > right namespace at the top of a file, which is sucked in via load). > > Sincerely > Meikel -- 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
Re: trouble getting library structure right: can't let files talk to each other
I feel a blog-post coming when I figured this out :-) On Aug 17, 2:26 pm, jandot wrote: > Thanks Rasmus, Meikel, > > This does help a lot already. > > There still seems to be an issue with using some of the things, > though. When I do > > (require '(my-important-project core analysis-2)) > > I would logically do (in-ns 'my-important-project.analysis-2) because > that's where all the functions are that I actually have to call. > > I am then still able to print out the some-constant from core by > > (println my-important-project.core/some-constant) > > but it seems that this does not work for the congomongo connection to > a mongodb database (also referred to in the core.clj file): > > (println (my-important-project.core/fetch-one :data)) ; => No such > var: my-important-project.core/fetch-one > > For this to work I have to reference the underlying > "somnium.congomongo" directly instead of my-important-project.core: > > (println (somnium.congomongo/fetch-one :data)) ; => works > > Is there a way to make "fetch-one" and "some-constant" available > within the analysis-2 namespace using their unqualified names? What > about defining the namespace at the top of the analysis-2.clj file > like this? > > (ns my-important-project.analysis-2 > (:use [my-important-project core])) > > and just saying (require '(my-important-project analysis-2)) in the > repl (so without mentioning core)? This *does* make it possible to get > to "some-constant" directly, but still no luck with the congomongo > (fetch-one) function. > > I don't understand why... If congomongo is "used" within core and core > is "used" within analysis-2, this does not mean that the congomongo > functions are available in analysis-2 without explicit calling of > congomongo? That would be unfortunate, because I'd have to start > "using" congomongo in several places, as well as incanter and other > libraries... > > jan. > > On Aug 17, 1:10 pm, Meikel Brandmeyer wrote: > > > > > Hi, > > > On 17 Aug., 13:39, Rasmus Svensson wrote: > > > > (in-ns 'my-important-project.analysis-2) > > > > or simply use the ns macro: > > > > (ns my-important-project.analysis-2) > > > Please note, that these two are *not* equivalent! > > > With ns: > > > Clojure 1.1.0 > > user=> (ns foo.bar (:refer-clojure :exclude (map))) > > nil > > foo.bar=> (def map 5) > > #'foo.bar/map > > foo.bar=> (in-ns 'user) > > # > > user=> (ns foo.bar) > > java.lang.IllegalStateException: map already refers to: #'foo.bar/map > > in namespace: foo.bar (NO_SOURCE_FILE:4) > > > With in-ns: > > Clojure 1.1.0 > > user=> (ns foo.bar (:refer-clojure :exclude (map))) > > nil > > foo.bar=> (def map 5) > > #'foo.bar/map > > foo.bar=> (in-ns 'user) > > # > > user=> (in-ns 'foo.bar) > > # > > > ns should really only be used to define a namespace. Then you should > > use in-ns to switch namespaces in the Repl (or to ensure we are in the > > right namespace at the top of a file, which is sucked in via load). > > > Sincerely > > Meikel -- 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
Re: trouble getting library structure right: can't let files talk to each other
Thanks for the clarification. I think I have everything working now. j. On Aug 17, 3:14 pm, Meikel Brandmeyer wrote: > Hi, > > luckily use is not transitive. If you want to use congomongo from > analysis-2 you have to do: > > (ns my-important-project.analysis-2 > (:use somnium.congomongo)) > > (println (fetch-one :data)) > > or (nameing what you need explicitly; prefered) > > (ns my-important-project.analysis-2 > (:use [somnium.congomongo :only (fetch-one)])) > > (println (fetch-one :data)) > > or (using an alias; also prefered over plain :use) > > (ns my-important-project.analysis-2 > (:require [somnium.congomongo :as congo])) > > (println (congo/fetch-one :data)) > > Hope this helps. > > Sincerely > Meikel -- 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