[racket-users] Re: How to draw an arc with module `graphics/turtles`?

2021-02-01 Thread making-a-racket
Turtles can only turn or move forward with or without drawing. To draw an 
arc, you'll need to combine these methods to do that.

I highly recommend the book *Turtle Geometry* by Abelson and diSessa 
.
 
Below you can find an excerpt of the book that talks about drawing circles 
and arcs.

[image: turtle.PNG]

Here's an implementation of a circle in Racket using the turtle library you 
referenced.

#lang racket

(require graphics/turtles)

(turtles #t)

(for ([i (in-range 360)])
  (draw 1)
  (turn 1))

On Monday, February 1, 2021 at 5:54:05 PM UTC-6 zhuo...@gmail.com wrote:

> I am imitating the Logo API to draw some shapes with `graphics/turtles`, 
> but in it I only find functions to draw lines, is there a way to draw an 
> arc?
>
>
>
> Greetings.
>
> Killian Zhuo (KDr2, https://kdr2.com)
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/aea4ad53-162e-4924-87ed-1e7311c2aef3n%40googlegroups.com.


[racket-users] Re: Looking for idiomatic way to represent very similar but different data types

2021-02-01 Thread making-a-racket
Turns out that I don't see a way to calculate the #:auto-value using the 
constructor fields, so I don't see how to make something like

(struct test (x y z [data #:auto])
  #:auto-value #(x y z))

work.

So I've decided to go with something like this:

(struct color (r g b) #:transparent)
(struct vector (i j k) #:transparent)
(struct point (x y z) #:transparent)

(define/contract (tuple-map-elementwise proc tuple)
  (-> (-> real? real?) (or/c vector? point? color?) (or/c vector? point? 
color?))
  (match tuple
[(struct vector (i j k)) (vector (proc (vector-i tuple))
 (proc (vector-j tuple))
 (proc (vector-k tuple)))]
[(struct point (x y z)) (point (proc (point-x tuple))
   (proc (point-y tuple))
   (proc (point-z tuple)))]
[(struct color (r g b)) (color (proc (color-r tuple))
   (proc (color-g tuple))
   (proc (color-b tuple)))]))

(define/contract (tuple-map-pairwise proc tuple1 tuple2)
  (-> (-> real? real? real?) (or/c vector? point? color?) (or/c vector? 
point? color?) (or/c vector? point? color?))
  (match (list tuple1 tuple2)
[(list (struct vector (i1 j1 k1)) (struct vector (i2 j2 k2)))
 (vector (proc (vector-i tuple1) (vector-i tuple2))
 (proc (vector-j tuple1) (vector-j tuple2))
 (proc (vector-k tuple1) (vector-k tuple2)))]
[(list (struct point (x1 y1 z1)) (struct point (x2 y2 z2)))
 (point (proc (point-x tuple1) (point-x tuple2))
(proc (point-y tuple1) (point-y tuple2))
(proc (point-z tuple1) (point-z tuple2)))]
[(list (struct color (r1 g1 b1)) (struct color (r2 g2 b2)))
 (color (proc (color-r tuple1) (color-r tuple2))
(proc (color-g tuple1) (color-g tuple2))
(proc (color-b tuple1) (color-b tuple2)))]))

(define (tuple-op-by-constant op tuple c)
  (tuple-map-elementwise (λ (e) (op e c)) tuple))

(define (tuple-op-pairwise op t1 t2 . tuples)
  (cond [(empty? tuples) (tuple-map-pairwise op t1 t2)]
[else (apply tuple-op-pairwise op
 (tuple-map-pairwise op t1 t2)
 (car tuples)
 (cdr tuples))]))

(define (vector+c v c)
  (tuple-op-by-constant + v c))

(define (vector*c v c)
  (tuple-op-by-constant * v c))

(define (vector+ u v . vectors)
  (apply tuple-op-pairwise + u v vectors))

(define (vector- u v . vectors)
  (apply tuple-op-pairwise - u v vectors))

Then I'll do something similar for points and colors. This library will 
probably be converted to Typed Racket, so the contracts are only temporary.

This seems to be the cleanest solution I think, and it's actually quite 
similar to the F# code I've written for the same project.

I know this seems simple, but wanted to check on people's thoughts on 
idiomatic ways in Racket, and to make sure I wasn't missing some secret 
sauce of structs or something else.


On Monday, February 1, 2021 at 4:38:37 PM UTC-6 making-a-racket wrote:

> Apologies. By fourth optional argument, I meant a fourth field with the 
> #auto field option. I'm experimenting with this now.
>
> On Monday, February 1, 2021 at 3:24:49 PM UTC-6 making-a-racket wrote:
>
>> Thanks for the suggestion and for the macro implementation. I'll have to 
>> pour over that a bit.
>>
>> I wanted to do map because I wanted to make it easy to idiomatically 
>> implement addition and other such operators on my data types such that they 
>> accept arbitrary amounts of arguments and provide the map for other uses.
>>
>> So that's why the vector (in the Racket sense) is the most simple option 
>> in that respect, since I can trivially do:
>>
>> (define (sum-vector v)
>> (apply + (vector->list v)))
>>
>> (define (vector+ . vs)
>> (apply vector-map + vs)) 
>>
>> (define (vector-i v)
>> (vector-ref v 0))
>> ;; and so on
>>
>> The only think I don't get there are my wanted datatypes and associated 
>> predicates, since vectors, points, and colors would all be Racket vectors.
>>
>> I could almost do structs with a fourth optional argument that holds a 
>> Racket vector that never gets used explicitly by the "user" and build 
>> helper functions to properly update it, which is then used to build all the 
>> operator and other such functions.
>>
>> If I just do structs as I originally notated, how do you suggest I 
>> implement things like vector+ to take in arbitrary amounts of arguments?
>>  
>>
>> On Monday, February 1, 2021 at 12:48:19 AM UTC-6 jackh...@gmail.com 
>> wrote:
>>
>>> I'd suggest just going wit

[racket-users] Re: Looking for idiomatic way to represent very similar but different data types

2021-02-01 Thread making-a-racket
Apologies. By fourth optional argument, I meant a fourth field with the 
#auto field option. I'm experimenting with this now.

On Monday, February 1, 2021 at 3:24:49 PM UTC-6 making-a-racket wrote:

> Thanks for the suggestion and for the macro implementation. I'll have to 
> pour over that a bit.
>
> I wanted to do map because I wanted to make it easy to idiomatically 
> implement addition and other such operators on my data types such that they 
> accept arbitrary amounts of arguments and provide the map for other uses.
>
> So that's why the vector (in the Racket sense) is the most simple option 
> in that respect, since I can trivially do:
>
> (define (sum-vector v)
> (apply + (vector->list v)))
>
> (define (vector+ . vs)
> (apply vector-map + vs)) 
>
> (define (vector-i v)
> (vector-ref v 0))
> ;; and so on
>
> The only think I don't get there are my wanted datatypes and associated 
> predicates, since vectors, points, and colors would all be Racket vectors.
>
> I could almost do structs with a fourth optional argument that holds a 
> Racket vector that never gets used explicitly by the "user" and build 
> helper functions to properly update it, which is then used to build all the 
> operator and other such functions.
>
> If I just do structs as I originally notated, how do you suggest I 
> implement things like vector+ to take in arbitrary amounts of arguments?
>  
>
> On Monday, February 1, 2021 at 12:48:19 AM UTC-6 jackh...@gmail.com wrote:
>
>> I'd suggest just going with the structs and making them transparent. It's 
>> only three structs and only with a handful of fields, abstracting over them 
>> with map and fold doesn't seem worth the added complexity IMO. But if you'd 
>> really like to map and fold over structs, I highly recommend using macros, 
>> `syntax-parse` and the struct-id 
>> <https://docs.racket-lang.org/syntax-classes/index.html?q=struct-id#%28form._%28%28lib._syntax%2Fparse%2Fclass%2Fstruct-id..rkt%29._struct-id%29%29>
>>  
>> syntax class to do so:
>>
>> (require (for-syntax syntax/parse/class/struct-id)
>>  syntax/parse/define)
>>
>> (define-simple-macro (struct-map type:struct-id instance-expr:expr 
>> map-function-expr:expr)
>>   (let ([map-function map-function-expr]
>> [instance instance-expr])
>> (type.constructor-id (map-function (type.accessor-id instance)) ...)))
>>
>> (struct point (x y z) #:transparent)
>>
>> ;; Outputs (point 2 3 4)
>> (struct-map point (point 1 2 3) add1)
>> On Sunday, January 31, 2021 at 4:20:03 PM UTC-8 making-a-racket wrote:
>>
>>> Hello. I have a project where I am needing to represent vectors (in the 
>>> mathematical sense), points, and colors. Both the vectors and points will 
>>> be 3D. I'm having trouble knowing what's an idiomatic way to represent and 
>>> interact with data types that are similar but different.
>>>
>>> In general, I could simply all represent them with a list or vector (in 
>>> the Racket sense). So I could have:
>>>
>>> (define (vector i j k) #(i j k))
>>> (define (point x y z) #(x y z))
>>>
>>> Then I could readily use the existing vector functions, such as 
>>> vector-map without having to define my own. But I don't super like this 
>>> because I have to define my own accessor functions like vector-i and 
>>> point-y and also don't get predicates like vector? for free.
>>>
>>> Another way is that I could use structs, but then I'm stuck implementing 
>>> things myself and across the structs. To avoid the latter point, I could 
>>> use pattern matching. So something like:
>>>
>>> (struct vector (i j k))
>>> (struct point (x y z))
>>>
>>> (define (tuple-map proc tuple)
>>>   (match tuple
>>> [(struct vector (i j k)) (vector (proc (vector-i tuple))
>>>  (proc (vector-j tuple))
>>>  (proc (vector-k tuple)))]
>>> [(struct point (x y z)) (point (proc (point-x tuple))
>>>(proc (point-y tuple))
>>>(proc (point-z tuple)))]
>>> [(struct color (r g b)) (color (proc (color-r tuple))
>>>(proc (color-g tuple))
>>>(proc (color-b tuple)))]))
>>>
>>> But of course, this map doesn't take multiple tuples. And this feels 
>>> aw

[racket-users] Re: Looking for idiomatic way to represent very similar but different data types

2021-02-01 Thread making-a-racket
Thanks for the suggestion and for the macro implementation. I'll have to 
pour over that a bit.

I wanted to do map because I wanted to make it easy to idiomatically 
implement addition and other such operators on my data types such that they 
accept arbitrary amounts of arguments and provide the map for other uses.

So that's why the vector (in the Racket sense) is the most simple option in 
that respect, since I can trivially do:

(define (sum-vector v)
(apply + (vector->list v)))

(define (vector+ . vs)
(apply vector-map + vs)) 

(define (vector-i v)
(vector-ref v 0))
;; and so on

The only think I don't get there are my wanted datatypes and associated 
predicates, since vectors, points, and colors would all be Racket vectors.

I could almost do structs with a fourth optional argument that holds a 
Racket vector that never gets used explicitly by the "user" and build 
helper functions to properly update it, which is then used to build all the 
operator and other such functions.

If I just do structs as I originally notated, how do you suggest I 
implement things like vector+ to take in arbitrary amounts of arguments?
 

On Monday, February 1, 2021 at 12:48:19 AM UTC-6 jackh...@gmail.com wrote:

> I'd suggest just going with the structs and making them transparent. It's 
> only three structs and only with a handful of fields, abstracting over them 
> with map and fold doesn't seem worth the added complexity IMO. But if you'd 
> really like to map and fold over structs, I highly recommend using macros, 
> `syntax-parse` and the struct-id 
> <https://docs.racket-lang.org/syntax-classes/index.html?q=struct-id#%28form._%28%28lib._syntax%2Fparse%2Fclass%2Fstruct-id..rkt%29._struct-id%29%29>
>  
> syntax class to do so:
>
> (require (for-syntax syntax/parse/class/struct-id)
>  syntax/parse/define)
>
> (define-simple-macro (struct-map type:struct-id instance-expr:expr 
> map-function-expr:expr)
>   (let ([map-function map-function-expr]
> [instance instance-expr])
> (type.constructor-id (map-function (type.accessor-id instance)) ...)))
>
> (struct point (x y z) #:transparent)
>
> ;; Outputs (point 2 3 4)
> (struct-map point (point 1 2 3) add1)
> On Sunday, January 31, 2021 at 4:20:03 PM UTC-8 making-a-racket wrote:
>
>> Hello. I have a project where I am needing to represent vectors (in the 
>> mathematical sense), points, and colors. Both the vectors and points will 
>> be 3D. I'm having trouble knowing what's an idiomatic way to represent and 
>> interact with data types that are similar but different.
>>
>> In general, I could simply all represent them with a list or vector (in 
>> the Racket sense). So I could have:
>>
>> (define (vector i j k) #(i j k))
>> (define (point x y z) #(x y z))
>>
>> Then I could readily use the existing vector functions, such as 
>> vector-map without having to define my own. But I don't super like this 
>> because I have to define my own accessor functions like vector-i and 
>> point-y and also don't get predicates like vector? for free.
>>
>> Another way is that I could use structs, but then I'm stuck implementing 
>> things myself and across the structs. To avoid the latter point, I could 
>> use pattern matching. So something like:
>>
>> (struct vector (i j k))
>> (struct point (x y z))
>>
>> (define (tuple-map proc tuple)
>>   (match tuple
>> [(struct vector (i j k)) (vector (proc (vector-i tuple))
>>  (proc (vector-j tuple))
>>  (proc (vector-k tuple)))]
>> [(struct point (x y z)) (point (proc (point-x tuple))
>>(proc (point-y tuple))
>>(proc (point-z tuple)))]
>> [(struct color (r g b)) (color (proc (color-r tuple))
>>(proc (color-g tuple))
>>(proc (color-b tuple)))]))
>>
>> But of course, this map doesn't take multiple tuples. And this feels 
>> awkward, because I'll need to implement other things, like fold. Map and 
>> fold would be used in defining new operators on vectors and points, like 
>> addition, normalization (for vectors only), etc.
>>
>> The ideal thing would be that I could define a struct for these types, 
>> that had the accessor functions like vector-i and predicates likes 
>> vector? but was actually represented by a vector (in the Racket sense) 
>> underneath the hood. Does something like this exist in Racket (not classes 
>> please).
>>
>> In F#, I did this 

[racket-users] Looking for idiomatic way to represent very similar but different data types

2021-01-31 Thread making-a-racket
Hello. I have a project where I am needing to represent vectors (in the 
mathematical sense), points, and colors. Both the vectors and points will 
be 3D. I'm having trouble knowing what's an idiomatic way to represent and 
interact with data types that are similar but different.

In general, I could simply all represent them with a list or vector (in the 
Racket sense). So I could have:

(define (vector i j k) #(i j k))
(define (point x y z) #(x y z))

Then I could readily use the existing vector functions, such as vector-map 
without having to define my own. But I don't super like this because I have 
to define my own accessor functions like vector-i and point-y and also 
don't get predicates like vector? for free.

Another way is that I could use structs, but then I'm stuck implementing 
things myself and across the structs. To avoid the latter point, I could 
use pattern matching. So something like:

(struct vector (i j k))
(struct point (x y z))

(define (tuple-map proc tuple)
  (match tuple
[(struct vector (i j k)) (vector (proc (vector-i tuple))
 (proc (vector-j tuple))
 (proc (vector-k tuple)))]
[(struct point (x y z)) (point (proc (point-x tuple))
   (proc (point-y tuple))
   (proc (point-z tuple)))]
[(struct color (r g b)) (color (proc (color-r tuple))
   (proc (color-g tuple))
   (proc (color-b tuple)))]))

But of course, this map doesn't take multiple tuples. And this feels 
awkward, because I'll need to implement other things, like fold. Map and 
fold would be used in defining new operators on vectors and points, like 
addition, normalization (for vectors only), etc.

The ideal thing would be that I could define a struct for these types, that 
had the accessor functions like vector-i and predicates likes vector? but 
was actually represented by a vector (in the Racket sense) underneath the 
hood. Does something like this exist in Racket (not classes please).

In F#, I did this same thing using F#'s records for the vector, point, and 
color data types, and they inherited an ITuple interface (F#'s immutable, 
functional data types can implement interfaces). Can Racket's stucts 
inherit from interfaces? Is there something I can do with generics?

Thanks for any help on this design.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/8214d59a-d6de-445f-b203-b0a2b8c374cdn%40googlegroups.com.


Re: [racket-users] Canvas animation performance

2021-01-12 Thread making-a-racket
Hi Doug,

Thanks for the response! I had indeed read about and tried you package, 
even before I made my post. However, installing the animated-canvas package 
with the package manager yields a bunch of warnings and errors. The lines 
example in your documentation works, but the animated plot is extremely 
laggy and doesn't seem to work. Also, installing the package created a lot 
of problems with DrRacket, where uncloseable command line windows popped up 
with errors and other instabilities (for example, DrRacket just crashing as 
soon as it opened). I had to uninstall it, even when not using it. The 
planet form also doesn't seem to work well to install the package 
interactively.

I am not usually one to optimize early but have been concerned and hesitant 
with getting too far into my project, knowing it will be heavy on graphics, 
with some of the performance issues I've seen in Racket. The catch is that 
Racket's pasteboard editor and draw library combined into a cross-platform 
package is too attractive. At least it seems I'm not misunderstanding 
something huge at this stage.

I'll forge on for the moment.

Thanks!

On Monday, January 11, 2021 at 11:02:39 AM UTC-6 m.douglas.williams wrote:

> While you may not be able to get high frame rates, there are some very 
> nice animations that are easy to produce, particularly in conjunction with 
> the plot package. Here is a short sample that animates a 3D plot.
>
> #lang racket/gui
>
> ;;; 3D animated plot example.
>
> (require plot
>  (planet williams/animated-canvas/animated-canvas))
>
> (define (main delta t-last)
>   (parameterize ((plot3d-samples 21))
> (let loop ((t 0.0))
>   (define (f x y) (* (sin (* 2.0 x)) (sin (* 2.0 y)) (cos t)))
>   (when (<= t t-last)
> (let* ((dc (send canvas get-dc))
>(width (send canvas get-width))
>(height (send canvas get-height)))
>   (plot3d/dc (contour-intervals3d f 0 pi 0 pi)
>  dc 0 0 width height
>  #:z-min -1 #:z-max 1)
>   (send canvas swap-bitmaps)
>   (yield)
>   (loop (+ t delta)))
>
> (define frame
>   (instantiate frame% ("Test Plot Animation")))
>
> (define canvas
>   (instantiate animated-canvas%
> (frame)
> (style '(border))
> (min-width 400)
> (min-height 300)))
>
> (send frame show #t)
>
> (main (* 0.05 pi) 20.0)
>
> Doug
>
> On Mon, Jan 11, 2021 at 9:45 AM Doug Williams  
> wrote:
>
>> I use Racket regularly for animations and wrote an animated-canvas 
>> package that does double buffering to smooth the animations for complex 
>> animations. I think you are running into some fundamental issues with frame 
>> rates possible with the drawing package in Racket. I have attached a 
>> version of your code using the animated-canvas package. It isn't any 
>> faster, but can (at least on my machine) handle 50,000 (or even 100,000) 
>> lines, although slowly. If you need speed, you can try using the OpenGL 
>> package.
>>
>> Doug
>>
>> On Sun, Jan 10, 2021 at 11:50 PM making-a-racket  
>> wrote:
>>
>>> Hello all,
>>>
>>> I am embarking upon a project to doing 2D graphics in Racket, so I am 
>>> starting off with various experiments, some of which include testing out 
>>> performance and replicating Processing examples.
>>>
>>> I definitely need to do some more reading, but I am wanting to post this 
>>> to get some leads into ensuring I'm utilizing the best performance of the 
>>> racket/draw library and for pointers to portions (or elaborations) of the 
>>> documentation.
>>>
>>> In trying to reproducing the LineRendering example that ships with 
>>> Processing, I'm seeing a big performance difference. The Processing sketch 
>>> is:
>>>
>>> public void setup() {
>>>   size(800, 600, P2D);  
>>> }
>>>   
>>> public void draw() {
>>>   background(255);
>>>   stroke(0, 10);
>>>   for (int i = 0; i < 5; i++) {
>>> float x0 = random(width);
>>> float y0 = random(height);
>>> float z0 = random(-100, 100);
>>> float x1 = random(width);
>>> float y1 = random(height);
>>> float z1 = random(-100, 100);
>>> 
>>> // purely 2D lines will trigger the GLU 
>>> // tessellator to add accurate line caps,
>>> // but performance will be substantially
>>> // lower.
>>> line(x0, y0, x1, y1);
>>>   }
>>

[racket-users] Canvas animation performance

2021-01-10 Thread making-a-racket
Hello all,

I am embarking upon a project to doing 2D graphics in Racket, so I am 
starting off with various experiments, some of which include testing out 
performance and replicating Processing examples.

I definitely need to do some more reading, but I am wanting to post this to 
get some leads into ensuring I'm utilizing the best performance of the 
racket/draw library and for pointers to portions (or elaborations) of the 
documentation.

In trying to reproducing the LineRendering example that ships with 
Processing, I'm seeing a big performance difference. The Processing sketch 
is:

public void setup() {
  size(800, 600, P2D);  
}
  
public void draw() {
  background(255);
  stroke(0, 10);
  for (int i = 0; i < 5; i++) {
float x0 = random(width);
float y0 = random(height);
float z0 = random(-100, 100);
float x1 = random(width);
float y1 = random(height);
float z1 = random(-100, 100);

// purely 2D lines will trigger the GLU 
// tessellator to add accurate line caps,
// but performance will be substantially
// lower.
line(x0, y0, x1, y1);
  }
}

My Racket code which attempts to reproduce this example is this:

#lang racket/gui

(require racket/draw)

(define WIDTH 800)
(define HEIGHT 600)

(define frame (new frame%
   [label "Lines"]
   [width WIDTH]
   [height HEIGHT]))

(define pen (new pen%
 [color (make-object color% 0 0 0 0.1)]
 [width 1]
 [style 'solid]))

(define (paint canvas dc)
  (send dc set-pen pen)
  (for ([i (in-range 1)])
(send dc draw-line
  (random 0 WIDTH)
  (random 0 HEIGHT)
  (random 0 WIDTH)
  (random 0 HEIGHT

(define canvas (new canvas%
[parent frame]
[paint-callback paint]))

(send frame show #t)

(define (loop)
  (send canvas refresh-now #:flush? #t)
  (sleep/yield 0.033)
  (loop))

(loop)

However, I am not able to obtain anywhere near the performance of the 
Processing sketch, which can draw 50,000 lines at about 12-13fps. It can do 
10,000 at about 40fps. My Racket example can barely do 10,000 lines and is 
definitely below 10fps. I am using Racket CS 7.9 on Windows 10 on an XPS 15 
i7 with dedicated GPU. Even p5.js' performance is well above the Racket 
sample but below the Processing sketch. Another thing that I have noticed 
is that the Processing sketch uses about 90% of the integrated GPU (not the 
dedicated) while Racket only uses about 6% of the integrated GPU. If I try 
to draw 50,000 lines, then Racket (usually) freezes up.

Any thoughts or pointers? If I understood the documentation correctly, 
refresh-now seemed to be the way to get the best frame-by-frame 
performance, but I am certainly still learning. Am I simply hitting the 
performance limit of the racket/draw library or is there something I can do 
to improve things?

I'm still in the programming language/environment selection phase of my 
project, but I would really like to use Racket here.

Thanks for any help!

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/535064cd-bc10-42fe-a20a-30623d5b4ca3n%40googlegroups.com.


[racket-users] Re: Using Racket behind proxy

2018-12-10 Thread making-a-racket
Does anyone have any input on this? This is an important hurdle for my, 
hopefully eventual, use of Racket at work, and I imagine it is important to 
other industrial users as well.

I have confirmed that it is indeed my work's proxy/firewall that is 
blocking Racket's package manager. For now, I have been able to get 
security exceptions made for the following Racket URLs:

   - https://download.racket-lang.org
   - https://mirror.racket-lang.org
   - https://pkgs.racket-lang.org
   - https://planet-compats.racket-lang.org

This is working better, but now the package manager is getting stuck at 
downloading the repository from github.com. For example, when trying to 
install "beautiful-racket", I get here:

Resolving "beautiful-racket" via 
https://download.racket-lang.org/releases/7.0/catalog/
Resolving "beautiful-racket" via https://pkgs.racket-lang.org
Downloading repository 
git://github.com/mbutterick/beautiful-racket/?path=beautiful-racket
tcp-connect: connection failed
  address: github.com
  port number: 443
  system error: A connection attempt failed because the connected party did 
not properly respond after a period of time, or established connection 
failed because connected host has failed to respond.; errid=10060

The error message is not good and differs on different machines, but I am 
suspecting the failure is due to using git:// instead of https://. The 
former won't be allowed through the proxy/firewall, but the latter would 
be. For git, you can configure git to use https:// rather than git@ or 
git://. Does anyone know if Racket is hard-coded to use git://? Is there 
any configuration file I can edit to change the method used? For example, 
in git, you can do:

git config --global url."https://".insteadOf git://

I am guessing the underlying mechanism is using the net/git-checkout 
library (https://docs.racket-lang.org/net/git-checkout.html)? Is there a 
local install of git in the Racket install location where I could provide a 
configuration for? Can I change the package manager code to use https:// 
instead?

Also, if anyone has any pointers to how to add proxy support and fix the 
git URL long term and for all users, I would be happy to try and see if I 
could make the changes myself to submit back to Racket.

Thanks.

On Thursday, September 13, 2018 at 1:59:43 PM UTC-4, making-a-racket wrote:
>
> Hello,
>
> I would love to experiment with and potentially use Racket at work, but I 
> am currently unable to use the package manager (raco) behind a proxy.
>
>
>1. Is there any advice for configuring the Racket ecosystem for being 
>used behind a proxy?
>2. Does Racket respect the "http_proxy", "https_proxy", and "no_proxy" 
>environment variables?
>3. What do the proxy settings in the Browser preferences tab do?
>
> I know that you can manually download and install packages, but I would 
> prefer not having to do that. It seems at some point Racket's package 
> manager explicitly did not support working behind proxies (
> https://lists.racket-lang.org/users/archive/2014-April/061965.html), but 
> I am not for sure if that is still the case.
>
>
> Thank you for any help!
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.