Sorry, I was tired and didn't explain very well.

Right now you have a "naked"
(:use clojure.contrib.seq-utils)
somewhere.

You want to use partition-by, but that's already in core, so you might
just get rid of the :use altogether.

But maybe there are some other functions in seq-utils that you do want
to use --- in that case, do
(:use [clojure.contrib [seq-utils :only [functions you want]]])
or
(:use [clojure.contrib [seq-utils :only []]])

to avoid stepping on core and also to document what you actually use.

If you really want the seq-utils version of partition-by, then you can do:

(:use [clojure.contrib [seq-utils :as whatever]])
whatever/partition-by

And if you really want to replace the core version with the seq
version without any namespacing, do

(:refer-clojure :exclude [partition-by])
(:use [clojure.contrib [seq-utils :only [partition-by]]])

does that help?

--Robert McIntyre






On Mon, Aug 30, 2010 at 2:43 PM, Chris Jenkins <cdpjenk...@gmail.com> wrote:
> How would using the :only keyword help here? Just to be clear, the problem
> here is that attempting to load my source file the second time fails
> (loading the first time having succeeded, albeit with a few warnings about
> replacing symbols from clojure.core), which makes it very difficult for me
> to use swank-clojure, for example, because I can't hit C-c C-k twice on the
> same file.
> Here is the failure when I try to load the file for the second time:
> java.lang.IllegalStateException: partition-by already refers to:
> #'clojure.contrib.seq-utils/partition-by in namespace: test.core
> (core.clj:1)
> So here's my main question: If I'm working in the REPL and I edit a file
> that I've preu'vviously loaded, how can I cause the file to be reloaded 
> without
> hitting that error? If my .clj file doesn't :use any other clojure modules
> then reloading works fine but, if it imports anything, then the second
> (load-file...) fails.
> On 30 August 2010 11:05, Robert McIntyre <r...@mit.edu> wrote:
>>
>> Yeah, they changed that from clojure 1.1 and it's really annoying ---
>> as far as I know, your only options right now are to either select
>> exactly which functions
>> from seq-utils you want using the :only keyword, or if you really want
>> to use the seq-utils version
>> you can use refer-clojure and the :exclude keyword. Or, you can use
>> the :as keyword in the :use form
>> to qualify the import so that you don't actually replace anything.
>>
>> If you accidently get this warning and don't want to restart the repl
>> you can do
>> (ns-unmap 'your-namespace 'offending-function), fix the naked import,
>> and reload.
>>
>> --Robert McIntyre
>>
>>
>>
>>
>> On Mon, Aug 30, 2010 at 5:54 AM, Chris Jenkins <cdpjenk...@gmail.com>
>> wrote:
>> > Since I switched to Clojure 1.2, I see an error message whenever I try
>> > to
>> > reload a source file that imports anything. The error message is of the
>> > form
>> > "xxxx already refers to xxx", as though it is complaining that it can't
>> > import the same thing twice.
>> > For example, I have a minimal source file that looks like this:
>> > (ns test.core
>> >   (:use clojure.contrib.seq-utils))
>> > I can load it (once!) into the Clojure REPL successfully:
>> > $ java -cp lib/clojure-contrib-1.2.0.jar:lib/clojure-1.2.0.jar
>> > clojure.main
>> > Clojure 1.2.0
>> > user=> (load-file "src/test/core.clj")
>> > WARNING: partition-by already refers to: #'clojure.core/partition-by in
>> > namespace: test.core, being replaced by:
>> > #'clojure.contrib.seq-utils/partition-by
>> > WARNING: frequencies already refers to: #'clojure.core/frequencies in
>> > namespace: test.core, being replaced by:
>> > #'clojure.contrib.seq-utils/frequencies
>> > WARNING: shuffle already refers to: #'clojure.core/shuffle in namespace:
>> > test.core, being replaced by: #'clojure.contrib.seq-utils/shuffle
>> > WARNING: reductions already refers to: #'clojure.core/reductions in
>> > namespace: test.core, being replaced by:
>> > #'clojure.contrib.seq-utils/reductions
>> > WARNING: partition-all already refers to: #'clojure.core/partition-all
>> > in
>> > namespace: test.core, being replaced by:
>> > #'clojure.contrib.seq-utils/partition-all
>> > WARNING: group-by already refers to: #'clojure.core/group-by in
>> > namespace:
>> > test.core, being replaced by: #'clojure.contrib.seq-utils/group-by
>> > WARNING: flatten already refers to: #'clojure.core/flatten in namespace:
>> > test.core, being replaced by: #'clojure.contrib.seq-utils/flatten
>> > nil
>> > If I try to reload it then I see an error message:
>> > user=> (load-file "src/test/core.clj")
>> > java.lang.IllegalStateException: partition-by already refers to:
>> > #'clojure.contrib.seq-utils/partition-by in namespace: test.core
>> > (core.clj:1)
>> > user=>
>> > This error message is seen even if I edit the source file and remove the
>> > (:use ...) clause and then try to load the file again.
>> > Anyone have any idea what is going on? I didn't see this behaviour in
>> > Clojure 1.1 and it would be nice if I could find a way to reload files
>> > that
>> > I'm working on.
>> > Cheers,
>> > Chris
>> >
>> > --
>> > 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
>
> --
> 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

Reply via email to