on "module: identifier already imported from a different source"

187 views
Skip to first unread message

Daniel Bastos

unread,
Jun 30, 2015, 8:24:33 AM6/30/15
to Racket Users
I'm getting "module: identifier already imported from a different
source" when I require these two modules.

(require math/number-theory)
(require racket/list)

I want factorize from math/number-theory and remove-duplicates from racket/list.

I've seen old messages about this error, but they seemed involved with
the full-fledged Racket, while I'm using ISL+ in DrRacket. I decided
to try some things out of HtDP and ended up getting into this trouble.

I don't want the full-fledged Racket because I like to use
check-expect in DrRacket and I seem to get along better with the
student languages error messages.

Solutions such as (require (rename ... ) don't work for me because I'm
speaking ISL+ where my options seem to me these below. (ASL doesn't
seem to expand on it.)

library-require = (require string)
| (require (lib string string ...))
| (require (planet string package))

Perhaps you could suggest me to leave the student languages sometimes
when playing with Racket by showing me how I could get some equivalent
thing to check-expect.

At some point I should move to full-fledged Racket. I suppose after
HtDP I should read another book. Perhaps Realm of Racket?

Thank you.

Jens Axel Søgaard

unread,
Jun 30, 2015, 8:44:56 AM6/30/15
to Daniel Bastos, Racket Users
Hi Daniel,

The problems is that math/number-threory and racket/list
both export an function named permutations.

You are right that rename-in or prefix-in could be used to 
fix the problem in "full" Racket. In order to handle the
situation in ISL+ I suggest to make an extra file:

File: "no-conflicts.rkt"
    #lang racket
    (provide (all-from-out math/number-theory)
             (all-from-out racket/list))
    (require math/number-theory)
   (require (except-in racket/list permutations))

And then in the ISL+ file write (require "no-conflicts.rkt").

/Jens Axel





--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
--
Jens Axel Søgaard

Philip Blair

unread,
Jun 30, 2015, 8:46:12 AM6/30/15
to Daniel Bastos, Racket Users
I don't believe there is a way to do what you are looking to do within
ISL+. To import *just* those two things in full-fledged Racket, one
would do (you may or may not already know this):
(require (only-in math/number-theory factorize))
(require (only-in racket/list remove-duplicates))

The problem is that the (only-in ...) form is not provided in ISL. In
addition, the above two lines would only *both* be required if you were
using #lang racket/base; using #lang racket automatically includes
racket/list.

That aside, it would seem that you must either advance to full Racket or
revisit your approach to the HtDP problem. I personally would suggest
the latter; I worked through all of HtDP last fall and never ran into a
problem like this :)

Matthias Felleisen

unread,
Jun 30, 2015, 10:03:49 AM6/30/15
to Daniel Bastos, Racket Users

On Jun 30, 2015, at 8:23 AM, Daniel Bastos <dba...@toledo.com> wrote:

> At some point I should move to full-fledged Racket. I suppose after
> HtDP I should read another book. Perhaps Realm of Racket?


When you have mastered a good part of HtDP, you should move on to Realm.
-- Matthias

Reply all
Reply to author
Forward
0 new messages