Hi John,

A couple of questions:

Although that’s how I ended up here, my actual problem came when I thought
“oh, I could just add this to my local copy of the number-theory package,
and test whether my implementation is faster or slower than modular-expt.”

I don’t understand why you need to “add this to … local copy of the
number-theory package”? If you want to compare your version with the math
package’s version, you can do something like:

#lang racket

(require math/number-theory)

(define (my-modular-expt a n) ...)

(time (my-modular-expt ...)) ; test your version
(time (modular-expt ...)) ; test the `math` package's version

In fact, by modifying the math package, you will no longer have the math
package’s version to compare to!

Slightly off-topic: do you find that the math package’s version is too
slow? Why did you try to implement your own version in the first place?

Best,

On Tue, Feb 16, 2021 at 5:24 PM Robby Findler <[email protected]>
wrote:

> I would not do it quite that way. Here's the steps I recommend:
>
> git clone https://github.com/racket/racket.git
> cd racket
> make # get some coffee here
> mkdir extra-pkgs
> cd extra-pkgs
> # make sure `raco` in your path is the one you built just above
> raco pkg update --clone math
>
> .... now do git stuff / racket stuff.
>
> The upside to avoiding the "PREFIX=..." is that the racket installation is
> now completely contained in that directory. Just throw it away when you're
> done with it and if you have more than one (perhaps you want to try out an
> older version or a released version or something) all you have to do is
> update your path. And if you want to update to get some bug fix or
> improvement, simply do a git pull and make in the top-level directory
> again. (That "make" really does include all of the steps, like it'll run
> configure and do all kinds of things so you don't have to worry about it.)
> And the "extra-pkgs" directory is just the convention some of us use.
>
> Robby
>
>
> On Tue, Feb 16, 2021 at 7:10 PM John Kemp <[email protected]>
> wrote:
>
>> > On Feb 16, 2021, at 3:49 PM, Robby Findler <[email protected]>
>> wrote:
>> >
>> > I think you probably want to use "raco update --clone math" and you'll
>> end up with a directory named "math": where you run that that is a clone of
>> the racket/math github repo and the racket installation you ran "raco" from
>> will now use that as the source. Then you can add a remote to it with your
>> clone to work on a pull request. You should be able to do this with your
>> own built version of racket (which you get by running "make" in the top
>> level of a clone of racket/racket) or in a snapshot build or probably even
>> in 8.0.
>> >
>> > Does that help?
>>
>> Thanks Robby, that definitely helped (although I’m not finished getting
>> this to work).
>>
>> Checking the correct sequence:
>>
>> 0. cd ~/src
>> 1. git clone https://github.com/racket/racket.git
>> 2. cd racket && make PREFIX=/usr/local
>> 3. cd .. && /usr/local/bin/raco pkg update —clone math (this worked FWIW
>> and cloned the math collection to my ~/src directory)
>> 4. cd racket && make PREFIX=/usr/local (to install the updated math
>> package into this copy of racket)
>> 5. /usr/local/bin/racket (to test changes in REPL)
>>
>> In my case, I think part of my problem was a) two copies of Racket
>> installed (so I needed to be more specific about which raco to use) and b)
>> not understanding where raco is doing its work.
>>
>> Cheers,
>>
>> - johnk
>>
>> >
>> > Robby
>> >
>> >
>> > On Tue, Feb 16, 2021 at 2:36 PM John Kemp <[email protected]>
>> wrote:
>> > Hi there,
>> >
>> > I implemented an alternative to the modular-expt function in the
>> math/number-theory package, that uses bit-shift (
>> https://gist.github.com/frumioj/2dcc1364464508ec359075d5014d0157), as
>> proposed by Bruce Scheier (pseudocode in
>> https://en.wikipedia.org/wiki/Modular_exponentiation).
>> >
>> > Although that’s how I ended up here, my actual problem came when I
>> thought “oh, I could just add this to my local copy of the number-theory
>> package, and test whether my implementation is faster or slower than
>> modular-expt.”
>> >
>> > First, I forked the github racket/math repo, and couldn’t see a way to
>> build that independently of Racket. So then I checked out the racket repo
>> itself, which uses raco to get me a copy of the math package collection. I
>> was able to build with that, but it seems unconnected to the github
>> racket/math repo.
>> >
>> > I tried various raco incantations to see if it were possible to get a
>> copy of my forked math package, but nothing seemed to work, and I am
>> concerned I misunderstood the instructions in
>> https://docs.racket-lang.org/racket-build-guide/index.html
>> >
>> > Is there any document that describes how I should be able to both build
>> and use a local math/number-theory package, and also be able to use my
>> forked copy of that repo to commit my changes? Is it possible for me to
>> *only* check out racket/math and build it for my local Racket installation?
>> >
>> > Thank you,
>> >
>> > - johnk
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "Racket Developers" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to [email protected].
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-dev/E30EA0E9-DC7F-498C-9F67-42554EBB757E%40gmail.com
>> .
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Racket Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-dev/CAL3TdONM%3DGm_t%3DO_X%3D%3DOcR1oj94yTXnSJ8zp3hU3OQ-qsFN2BA%40mail.gmail.com
> <https://groups.google.com/d/msgid/racket-dev/CAL3TdONM%3DGm_t%3DO_X%3D%3DOcR1oj94yTXnSJ8zp3hU3OQ-qsFN2BA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CADcuegsGg35AQgSLGKQ6K0G3imCNkm086WXmWa4YG_QJajEn_Q%40mail.gmail.com.

Reply via email to