Re: [racket-users] Pretty Printing for ASTs represented as structs

2020-08-16 Thread Jay McCarthy
I recommend defining the structs with `#:transparent` and just using
`pretty-write` or `pretty-print`.

Jay

--
Jay McCarthy
Associate Professor @ CS @ UMass Lowell
http://jeapostrophe.github.io
Vincit qui se vincit.


On Sun, Aug 16, 2020 at 4:48 PM Jeremy Siek  wrote:

>
> Hi All,
>
> I'm looking into using Racket structs to represent abstract syntax trees.
> I've gotten as far as defining gen:custom-write properties, but have not
> yet figured out how to control indenting. Also, I'm not sure I'm just
> calling
> write-string, write, and newline in my gen:custom-write methods, which I
> suspect is not exactly correct.
>
> Are there some good up-to-date examples of this that I could look at?
>
> Thanks,
> Jeremy
>
> --
> 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/550ad1e1-90af-4f6d-8f31-57fccfe2d25an%40googlegroups.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/CAJYbDakp%3DQkgOmEaSMODKB6sbxF7MFRBDcMgfajscxJvLa29zw%40mail.gmail.com.


[racket-users] Re: Pretty Printing for ASTs represented as structs

2020-08-16 Thread jackh...@gmail.com
I recommend using make-constructor-style-printer 
,
 
which automates a lot of the fiddly indentation-handling you'd have to do 
otherwise.
On Sunday, August 16, 2020 at 1:48:50 PM UTC-7 jerem...@gmail.com wrote:

>
> Hi All,
>
> I'm looking into using Racket structs to represent abstract syntax trees.
> I've gotten as far as defining gen:custom-write properties, but have not
> yet figured out how to control indenting. Also, I'm not sure I'm just 
> calling
> write-string, write, and newline in my gen:custom-write methods, which I
> suspect is not exactly correct.
>
> Are there some good up-to-date examples of this that I could look at?
>
> Thanks,
> Jeremy
>

-- 
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/f11193f4-9fb5-43fd-a54e-f5ebb5c9bb69n%40googlegroups.com.


[racket-users] pkg.racket-lang.org account creation / recovery failing

2020-08-16 Thread Marc Burns
Hi all,

I'm currently getting a stack trace starting with "subprocess: process
creation failed" when I try to get a code to sign up for
pkg.racket-lang.org. The stack trace shows up right after I enter my
email and hit "Email me a code". I've tried a few different email
addresses and browsers.

I've got a few brand new packages here and would love to be able to
publish them :)

(also posted a message on IRC about this)

Marc

-- 
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/a8d18288-16a2-59f4-b0bd-6239ece6defd%40uwaterloo.ca.


0x2E541A315E1B4A75.asc
Description: application/pgp-keys


[racket-users] Pretty Printing for ASTs represented as structs

2020-08-16 Thread Jeremy Siek

Hi All,

I'm looking into using Racket structs to represent abstract syntax trees.
I've gotten as far as defining gen:custom-write properties, but have not
yet figured out how to control indenting. Also, I'm not sure I'm just 
calling
write-string, write, and newline in my gen:custom-write methods, which I
suspect is not exactly correct.

Are there some good up-to-date examples of this that I could look at?

Thanks,
Jeremy

-- 
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/550ad1e1-90af-4f6d-8f31-57fccfe2d25an%40googlegroups.com.


saneboxes: welcome remedies for a world in turmoil [racket-users]

2020-08-16 Thread Etan Wexler

Matthew Flatt recommended “wrapping the sanebox creation”. Matthew, these 
saneboxes that you’ve invented seem to be just the devices that we’ve needed. 
We’d like an initial batch of 5000 saneboxes, as soon as you can manage, even 
if unwrapped. Please send the bill to 1500, Pennsylvania Avenue, Northwest, 
District of Columbia, 20220, United States of America. We appreciate your 
timely 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/2020-08-16_saneboxes%40r-6.org.


Re: [racket-users] Scribble and examples can't read racket-prefs.rktd

2020-08-16 Thread Deren Dohoda
Thank you Matthew, that did resolve the problem, though I was unable to 
ever determine why I could not display a plot from plot/pict. It seems that 
it was somehow related to (sandbox-output 'string) which could never be 
coerced display a bitmap, pict, etc. Ultimately I just used 
(make-base-eval) instead and skipped the sandbox.

Deren

On Sunday, August 16, 2020 at 8:06:49 AM UTC-4 Matthew Flatt wrote:

> Sandboxed filesystem and unsafety access is too strict for many
> purposes. For documentation, I recommend using a trusted sandbox by
> wrapping the sanebox creation with
> `call-with-trusted-sandbox-configuration`.
>
> Matthew
>
> At Sun, 16 Aug 2020 00:45:46 -0700 (PDT), Deren Dohoda wrote:
> > Hi Racketeers,
> > 
> > I'm going in absolute circles trying to understand what I might be doing 
> > wrong. I can use the command line scribble to generate html, which works 
> > fine except a problem showing # instead of an actual plot/pict 
> image. 
> > And for that matter the package installs fine using a local install. But 
> > trying to run the scribble file in DrRacket always gives me errors like 
> > "cannot read racket-prefs.rkt" or other errors like "cannot reference an 
> > identifier without a definition" and sometimes it will give me errors 
> like 
> > I have used (protect-out ...) somewhere but I am definitely not as I 
> didn't 
> > even learn about this kind of provide until I saw this error.
> > 
> > Does anyone using Windows have experience getting rid of this message or 
> > have an idea what I might be doing wrong? I have a feeling that this 
> > message isn't actually the problem and it's something to do with sandbox 
> > somehow.
> > 
> > @(define this-eval (parameterize ((sandbox-output 'string)
> > (sandbox-error-output 'string)
> > (sandbox-memory-limit 100))
> > (make-evaluator 'racket/base #:requires '("main.rkt" 
> > "fit.rkt" plot/pict)
> > (print-as-expression #f) 
> > )))
> > 
> > Thanks,
> > Deren
>

-- 
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/6852ab0a-ceb4-4799-b842-657582755747n%40googlegroups.com.


Re: [racket-users] Strange behaviour on re-executing an sgl program

2020-08-16 Thread Hendrik Boom
I've done more experimenting.


It now looks as if some resource is leaking away that
  * is not recovered when one run is cancelled, drracket closes the window, and 
another run is started, but
  * is recovered when I close the window before starting another run.


Experimental results:

If I run my more complicated program (I'll call it streets) it fails the second 
time I run it.
If I run sgl-hello-world.rkt (which I'll call 'hello' for short) after streets 
has failed, it fails immediately by producing the large white square.
If I run streets once, and repeatedly run sgl-hello-world.rkt after it, it 
fails after only about 11 runs, producing the large white square.

When starting straightway with hello, and running it repeatedly, oce the large 
white square arrives, it is no longer possible to dismiss the small window by 
clicking on its 'x' cose button in the window frame.  But doing another 'run' 
still does clese the window, and, of coures, creates another with the large 
white square.  And closing drracket still closes all the windows (except, of 
course, the uxterm from which I started drracket)

If I run streets and manually close its graphics window ny clicking on the 'x' 
in the window frame before I click 'run' again, it works properly, repeatedly 
(I tried 7 times).  But if after that I fail to close the window, it fails when 
I press 'run'.

Likewise, if I run hello repeatedly, closing its graphics window explicitly 
each time, it survives at least a hundred reruns.


-- hendrik

On Sun, Aug 16, 2020 at 09:32:19AM -0400, Hendrik Boom wrote:
> I hauled the sgl-hello-world program (attached below) into drrracket, version 
> 7.6, english by PLT.
> 
> I click on 'run'I click on 'run'.
> It creates a small window containing a small white square.
> 
> I click on 'run' again.
> It deetes that window, and creates another small window
> containing a small white square.
> 
> 
> I click on 'run' again. 
> It deetes that window, and creates another small window
> containing a small white square.
> 
> I click on 'run' again. 
> It deetes that window, and creates another small window
> containing a small white square.
> 
> etc.
> 
> After about 35 runs, the new small window instead contains a large white 
> square filling the entire window.
> 
> Evidently, something happens after multiple runs.  Perhaps spme resource 
> is exhausted  Perhaps it's random and might happen after a hundred runs 
> another time?  I don't know.  But I'm having similarly erratic behaviour 
> in a far more complicated program, and this is the simplest version of 
> erraticity I've found so far.
> 
> This code was found on the Racket users mailing list archives.
> 
> -- hendrik
> 
> --
> #lang racket/gui
> 
> ; This code from 
> https://groups.google.com/forum/#!topic/racket-users/-84bgybC3C0
> ; -- hendrik
> 
> (require (lib "gl.ss" "sgl")
>  (lib "gl-vectors.ss" "sgl")
> )
>  
>  
> (define (resize w h)
>   (glViewport 0 0 w h)
>   #t
> )
>  
> (define (draw-opengl)
>   (glClearColor 0.0 0.0 0.0 0.0)
>   (glClear GL_COLOR_BUFFER_BIT)
>   (glColor3d 1.0 1.0 1.0)
>   
>   (glMatrixMode GL_PROJECTION)
>   (glLoadIdentity)
>   (glOrtho 0.0 1.0 0.0 1.0 -1.0 1.0)
>   (glMatrixMode GL_MODELVIEW)
>   (glLoadIdentity)
>  
>   (glBegin GL_QUADS)
>   (glVertex3d 0.25 0.25 0.0)
>   (glVertex3d 0.75 0.25 0.0)
>   (glVertex3d 0.75 0.75 0.0)
>   (glVertex3d 0.25 0.75 0.0)
>   (glEnd)
> )
>  
>  
> (define my-canvas%
>   (class* canvas% ()
> (inherit with-gl-context swap-gl-buffers)
> 
>(define/override (on-paint)
>   (with-gl-context
> (lambda ()
>   (draw-opengl)
>   (swap-gl-buffers)
> )
>   )
> )
> 
> (define/override (on-size width height)
>   (with-gl-context
> (lambda ()
>   (resize width height)
> )
>   )
> )
> 
> (super-instantiate () (style '(gl)))
>   )
> ) 
>  
> (define win (new frame% (label "OpenGl Test") (min-width 200) 
> (min-height 200)))
> (define gl  (new my-canvas% (parent win)))
>  
> (send win show #t)
>  
> 
> 
> ; It should be pretty easy to tweak it.
> 
> ; Hope this helps,
> ; Laurent
> 
> 
> ; - show quoted text -
> 
> ; - show quoted text -
> ; _
> ;  For list-related administrative tasks:
> ;  http://lists.racket-lang.org/listinfo/users
> 
> 
> -- 
> 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/20200816133219.ln7ameblw7pvpnxo%40topoi.pooq.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 

Re: [racket-users] lsp server

2020-08-16 Thread Philip McGrath
On Fri, Jul 31, 2020 at 2:46 PM Catonano  wrote:

> I'm playing with a toy project in #Racket
> 
>
I'd like to use the lsp server…
>
how do I connect to it from my Emacs based client ?
>

Just in case by "use the lsp server" you meant "set up Emacs to work on a
Racket project" (rather than working *on* the lsp server or client), the
generally preferred way to edit Racket in Emacs is with Greg Hendershott's
Racket Mode (actually a package with a few major and minor modes):
https://www.racket-mode.com

-Philip

-- 
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/01000173f78714a6-5170a43f-d553-407e-89e8-db6db26d911e-00%40email.amazonses.com.


[racket-users] Strange behaviour on re-executing an sgl program

2020-08-16 Thread Hendrik Boom
I hauled the sgl-hello-world program (attached below) into drrracket, version 
7.6, english by PLT.

I click on 'run'I click on 'run'.
It creates a small window containing a small white square.

I click on 'run' again.
It deetes that window, and creates another small window
containing a small white square.


I click on 'run' again. 
It deetes that window, and creates another small window
containing a small white square.

I click on 'run' again. 
It deetes that window, and creates another small window
containing a small white square.

etc.

After about 35 runs, the new small window instead contains a large white 
square filling the entire window.

Evidently, something happens after multiple runs.  Perhaps spme resource 
is exhausted  Perhaps it's random and might happen after a hundred runs 
another time?  I don't know.  But I'm having similarly erratic behaviour 
in a far more complicated program, and this is the simplest version of 
erraticity I've found so far.

This code was found on the Racket users mailing list archives.

-- hendrik

--
#lang racket/gui

; This code from 
https://groups.google.com/forum/#!topic/racket-users/-84bgybC3C0
; -- hendrik

(require (lib "gl.ss" "sgl")
 (lib "gl-vectors.ss" "sgl")
)
 
 
(define (resize w h)
  (glViewport 0 0 w h)
  #t
)
 
(define (draw-opengl)
  (glClearColor 0.0 0.0 0.0 0.0)
  (glClear GL_COLOR_BUFFER_BIT)
  (glColor3d 1.0 1.0 1.0)
  
  (glMatrixMode GL_PROJECTION)
  (glLoadIdentity)
  (glOrtho 0.0 1.0 0.0 1.0 -1.0 1.0)
  (glMatrixMode GL_MODELVIEW)
  (glLoadIdentity)
 
  (glBegin GL_QUADS)
  (glVertex3d 0.25 0.25 0.0)
  (glVertex3d 0.75 0.25 0.0)
  (glVertex3d 0.75 0.75 0.0)
  (glVertex3d 0.25 0.75 0.0)
  (glEnd)
)
 
 
(define my-canvas%
  (class* canvas% ()
(inherit with-gl-context swap-gl-buffers)

   (define/override (on-paint)
  (with-gl-context
(lambda ()
  (draw-opengl)
  (swap-gl-buffers)
)
  )
)

(define/override (on-size width height)
  (with-gl-context
(lambda ()
  (resize width height)
)
  )
)

(super-instantiate () (style '(gl)))
  )
) 
 
(define win (new frame% (label "OpenGl Test") (min-width 200) 
(min-height 200)))
(define gl  (new my-canvas% (parent win)))
 
(send win show #t)
 


; It should be pretty easy to tweak it.

; Hope this helps,
; Laurent


; - show quoted text -

; - show quoted text -
; _
;  For list-related administrative tasks:
;  http://lists.racket-lang.org/listinfo/users


-- 
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/20200816133219.ln7ameblw7pvpnxo%40topoi.pooq.com.


Re: [racket-users] Scribble and examples can't read racket-prefs.rktd

2020-08-16 Thread Matthew Flatt
Sandboxed filesystem and unsafety access is too strict for many
purposes. For documentation, I recommend using a trusted sandbox by
wrapping the sanebox creation with
`call-with-trusted-sandbox-configuration`.

Matthew

At Sun, 16 Aug 2020 00:45:46 -0700 (PDT), Deren Dohoda wrote:
> Hi Racketeers,
> 
> I'm going in absolute circles trying to understand what I might be doing 
> wrong. I can use the command line scribble to generate html, which works 
> fine except a problem showing # instead of an actual plot/pict image. 
> And for that matter the package installs fine using a local install. But 
> trying to run the scribble file in DrRacket always gives me errors like 
> "cannot read racket-prefs.rkt" or other errors like "cannot reference an 
> identifier without a definition" and sometimes it will give me errors like 
> I have used (protect-out ...) somewhere but I am definitely not as I didn't 
> even learn about this kind of provide until I saw this error.
> 
> Does anyone using Windows have experience getting rid of this message or 
> have an idea what I might be doing wrong? I have a feeling that this 
> message isn't actually the problem and it's something to do with sandbox 
> somehow.
> 
> @(define this-eval (parameterize ((sandbox-output 'string)
>   (sandbox-error-output 'string)
>   (sandbox-memory-limit 100))
>  (make-evaluator 'racket/base #:requires '("main.rkt" 
> "fit.rkt" plot/pict)
>  (print-as-expression #f) 
>  )))
> 
> Thanks,
> Deren

-- 
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/20200816060642.e5%40sirmail.smtps.cs.utah.edu.


[racket-users] Scribble and examples can't read racket-prefs.rktd

2020-08-16 Thread Deren Dohoda
Hi Racketeers,

I'm going in absolute circles trying to understand what I might be doing 
wrong. I can use the command line scribble to generate html, which works 
fine except a problem showing # instead of an actual plot/pict image. 
And for that matter the package installs fine using a local install. But 
trying to run the scribble file in DrRacket always gives me errors like 
"cannot read racket-prefs.rkt" or other errors like "cannot reference an 
identifier without a definition" and sometimes it will give me errors like 
I have used (protect-out ...) somewhere but I am definitely not as I didn't 
even learn about this kind of provide until I saw this error.

Does anyone using Windows have experience getting rid of this message or 
have an idea what I might be doing wrong? I have a feeling that this 
message isn't actually the problem and it's something to do with sandbox 
somehow.

@(define this-eval (parameterize ((sandbox-output 'string)
  (sandbox-error-output 'string)
  (sandbox-memory-limit 100))
 (make-evaluator 'racket/base #:requires '("main.rkt" 
"fit.rkt" plot/pict)
 (print-as-expression #f) 
 )))

Thanks,
Deren

-- 
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/bb013d47-3f7b-4eb2-979a-a5c55e4b5b3dn%40googlegroups.com.