[racket-users] Please can I use sgl to draw to a bitmap

2022-04-24 Thread Hendrik Boom
I am currently using sgl to draw to a window, and using the screenshot progrm 
to convert tie picture to a .png file.
Unfortunately, this seems to linut the png to screen size, and I need more 
pixels thatn that for my application.

So my guess is that I need to create an sgl-compatible opengl environment that 
draws toa bitmap instead of a window, and then use the tools available to write 
that bitmap out as a .png file.

Trouble is, I don't know how to get a bitmap out of sgl.

Here's the function I use to vreate the window and call a function called 
drawer to draw into it.

(define (environ drawer)
  #;(printf "in environ\n")
  (define my-canvas%
(class* canvas% ()
  (inherit with-gl-context swap-gl-buffers)
  
  (define/override (on-paint) ; When is on-paint caled?
(printf "on-paint ~s~n" (count))
(with-gl-context
(lambda ()
  #;(printf "call drawer~n")
  (drawer)
  #;(printf "returned from drawer~n")
  (swap-gl-buffers)
  )
  )
)

  (define/override (on-size width height) ; Is this what is called when 
resizing the window with a mouse?
(with-gl-context
(lambda ()
  (resize width height)
  )
  )
)
  
  (super-instantiate () (style '(gl))) ; What is this?
  )
)
  #;(printf "before win~n")
  (define win (new frame% (label "OpenGl Test")
   (min-width 600)
   (min-height 600)))
  #;(printf "before my-canvas~n")
  (define gl (new my-canvas% (parent win)))
  #;(printf "before show~n")
  (send win show #t)  ;  presumably this runs the on-paint method.
  ; But why does it get called three times?
  #;(printf "out-environ~n")
  )

-- hendrik

-- 
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/20220424215803.GB14417%40topoi.pooq.com.


Re: [racket-users] Possible options for stopping spam

2021-12-15 Thread Hendrik Boom
On Wed, Dec 15, 2021 at 12:54:30PM -0500, George Neuner wrote:
> 
> Is there a way to whitelist / trust posters.  One of the other groups I
> follow is moderated, but is set up so that messages from trusted posters go
> straight through.  The moderator(s) only have to look at posts coming from
> untrusted sources and decide whether new posters can be trusted.
> 
> Caveat: I don't know how much effort that requires.  It just seems like a
> possible 4th option (if doable).

This was done for the Babylon 5 usenet group a few dacades ago.
Of course, that wasn't a Google-provided mailin list.

-- hendrik

> 
> 
> On 12/14/2021 10:02 PM, Sage Gerard wrote:
> > 
> > > Wouldn't people asking to be invited be pretty much the same
> > moderation burden as option 3, but with less support? I guess that's a
> > way of saying I lean to option 3.
> > 
> > I see what you mean. I saw "invite-only" as the option with the most
> > /discretionary/ effort when volunteers are scarce, since a trusted
> > member of this community can add a member with a presumably lower risk
> > of introducing a spammer. Since I'm not going to be available to ban
> > spammers forever, I'm reading these options in terms of minimizing the
> > reasons someone has to drop what they are doing to mess with the list.
> > 
> > On 12/14/21 3:53 PM, David Bremner wrote:
> > > Sage Gerard  writes:
> > > 
> > > > All,
> > > > 
> > > > I've gained administrative privileges over this list to address the 
> > > > spammer. I want to hear from others before I touch anything.
> > > > 
> > > Thanks for putting effort into this.
> > > 
> > > > I've been informed that an invite-only approach might not be 
> > > > appropriate, but without moderation, the only option I see is to change 
> > > > the privacy settings. Here are the choices Google gives us.
> > > > 
> > > > - Invited users only
> > > > - Anyone on the web can join
> > > > - Anyone on the web can ask
> > > Wouldn't people asking to be invited be pretty much the same moderation
> > > burden as option 3, but with less support? I guess that's a way of
> > > saying I lean to option 3.
> > > 
> > > > Comments welcome, but note that I do not know the chain of command. If
> > > > it comes down to my judgement, please let me know.
> > > > 
> > > Pretty sure I'm not in any relevant chain of command.
> > > 
> > > d
> 
> -- 
> 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/f22fdcd2-0781-4012-d906-cad44617ddc4%40comcast.net.

-- 
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/20211215183814.GA713%40topoi.pooq.com.


Re: the end of the [racket-users] mailing list and the migration to Discourse as a forum for Racket

2021-11-22 Thread Hendrik Boom
First reason for ignoring this message:

It's an html-only post on a text mailing list.

-- hendrik


On Mon, Nov 22, 2021 at 08:06:01AM -0500, Etan Wexler wrote:

-- 
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/2021113659.GA16849%40topoi.pooq.com.


Re: [racket-users] What are the most used Racket libraries, applications and languages?

2021-11-14 Thread Hendrik Boom
On Fri, Nov 12, 2021 at 11:46:02PM +, Stephen De Gabrielle wrote:
> What are the most used Racket libraries, applications and languages?
> 
> I’ll admit I’m guilty of going whole releases without installing anything
> because the distribution has so much included.
> 
> If you reply with what you have installed I’ll tally it up!

Is there ah easyway to ask the installed Racket system what libraries, 
applications, and languages are installed?

-- hendrik

> 
> Stephen
> 
> I’m also doing this on
> https://racket.discourse.group/
> -- 
> 
> 
> -- 
> 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/CAGHj7-%2BUk2G886SVA%3DaaomD6Qm5S%3D765WyBznj_6kwz2K1AqCQ%40mail.gmail.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/2024160922.GA27060%40topoi.pooq.com.


Re: [racket-users] Re: [ANN] fmt: a Racket code formatter

2021-10-19 Thread Hendrik Boom
On Tue, Oct 19, 2021 at 11:07:58AM -0700, Sorawee Porncharoenwase wrote:
> On Tue, Oct 19, 2021 at 7:01 AM Diego Crespo
> mycontributiontothewo...@gmail.com
>  wrote:
> 
> If you are curious about what the output looked like before, here is the
> > pasterack link of some of my code http://pasterack.org/pastes/23639.
> > Racket supports using brackets instead of parenthesis, but you typically
> > only see it used in things like cond and let expressions. This was adding
> > them to far more expressions. Other than looking odd, there was nothing
> > wrong with the code (other than my own errors :))
> >
> FWIW, here’s what the tool would output now (provided that the input code’s
> paren shapes are not yet compromised): http://pasterack.org/pastes/21352
> 
> raco fmt will usually keep paren shape intact, but it can convert paren
> shape in some positions. Right now, the only conversion is from parenthesis
> to bracket, and it’s enabled for:
> 
>- cond, case-lambda, match, case body
>- syntax-case, syntax-rules body
>- syntax-parse (including syntax-parser and define-syntax-parser) body.
>- for bindings (including for/... and for*/...)
>- let bindings (including letrec, let-syntax, let-values, …)
>- parameterize, with-syntax, shared bindings
>- and a few more
> 
> What happened earlier was that class was erroneously configured to have
> this paren shape conversion, even though it should not.

I find the layout of the second version more readable,
but find the choice of parenthesis shape in the first version more readable.

-- hendrik

> 
> On Tuesday, October 19, 2021 at 9:34:04 AM UTC-4 hen...@topoi.pooq.com
> > wrote:
> >
> >> and was disappointed.
> >>
> > I would not recommend this, but if you strongly feel that the class body
> should use brackets, you are free to write your own formatting rules.
> (Though I have not documented how to do so.)
> 
> -- 
> 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/CADcuegs%2BepCLAXHzjXxPdq%3DR6su0heHOJRBYgWL7_tLj5J%3Db2A%40mail.gmail.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/20211020014753.yl36iozz5wzpcyzb%40topoi.pooq.com.


Re: [racket-users] Re: [ANN] fmt: a Racket code formatter

2021-10-19 Thread Hendrik Boom
When I read this:

> On Mon, Oct 18, 2021 at 6:14 PM Diego Crespo <
> mycontributiontothewo...@gmail.com> wrote:
> 
> > This is really cool. Between this, a Racket linter, and an LSP, Racket is
> > seriously looking a lot better for larger teams. I ran it through some of
> > my code and I'm curious about the decision to use brackets more liberally.
> > I was surprised when it changed my methods in my classes to be bracketed,
> > as well as the init, and field expressions. I could probably get used to it
> > given enough time, but I haven't seen that style in other Racket code
> > before.

I thought, great!  This will ameilorate the perennial parenthesis problem by 
using 
different kinds of brackets for different uses.

THen I read this:

On Mon, Oct 18, 2021 at 07:06:41PM -0700, Sorawee Porncharoenwase wrote:
> Don't get used to it. It's a bug!
> 
> Fixed in
> https://github.com/sorawee/fmt/commit/e056aee1e9a3ea0a72a4c85075426fa76f037852.
> Thanks for the report!

and was disappointed.

The I started wondering -- just what did it look like, that the use of 
different 
brackets would be considered a problem?

-- hendrik

-- 
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/20211019133356.257w6kempwu57api%40topoi.pooq.com.


Re: [racket-users] Racket meeting tomorrow?

2021-10-01 Thread Hendrik Boom
On Fri, Oct 01, 2021 at 12:31:27PM -0700, Sam Phillips wrote:
> October 2, 2021
> 1 PM PDT
> 4 PM EDT
> 8 PM UTC
> 10 PM CEST
> 
> Should be the same URL as previous meetups.
> 
> https://gather.town/app/wH1EDG3McffLjrs0/racket-users

I'll try to be there even though I haven't been doing much Racketting lately.
I didn't see it announced in Racket News, so I asked.

-- hendrik

> 
> Cheers,
> Sam
> 
> On Fri, Oct 1, 2021 at 9:49 AM Hendrik Boom  wrote:
> >
> > Is there going to be a Racket online meeting at the gather site tomorrow
> > on October 2?  There have been on previous
> > first-Saturdays-in-the-month.If so, at what time, and what's the URL?
> >
> > -- hendrik
> >
> > --
> > 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/20211001164939.xrugfg7xlkj4pmfo%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 racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAHsjV0z50cCKJ8FkvG2fz%2BDnQ34CuWj6R1ML2_d80VmvEYG2eQ%40mail.gmail.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/20211001195605.mgkunetdn7kqykhd%40topoi.pooq.com.


Re: [racket-users] Re: Escape continuations for fussy code

2021-10-01 Thread Hendrik Boom
On Fri, Oct 01, 2021 at 02:32:52PM -0400, David Storrs wrote:
> On Fri, Oct 1, 2021 at 11:58 AM Hendrik Boom  wrote:
> 
> > On Fri, Oct 01, 2021 at 02:22:14PM +, Jesse Alama wrote:
> > > Hello,
> > >
> > > Have you ever wished you could do a C-style return in the middle
> > > of a block of Racket code? When you're in the heat of things with
> > > a complicated problem where input values need a fair amount of
> > > multi-stage extraction and validation, using cond quickly pulls
> > > code to the right. My procedure is:
> > >
> > > * cond/case. In each branch:
> > > * Define some new values safe in the knowledge of where you are
> > > (extract) and perhaps check them, if necessasry (validate)
> > > * Make sure you have an else branch.
> > > * return to 1 and repeat as many times as necessary.
> > >
> > > The result:
> > >
> > > (cond [(foo? x)
> > > (define y (bar x))
> > > (define z (jazz x y))
> > > (cond [(loopy? z)
> > > (define a (yowza z))
> > > (cond [(string? a)
> > > (define b (bonkers a))
> > > (cond [(number? (hoop x b))
> > > (define ...)]
> > > [else
> > > (error 'um)])]
> > > [else
> > > (error 'ugh)])]
> > > [else #f])]
> > > [else #f])
> >
> >
> I'm presuming that this code should either return #f, return a calculated
> value, or raise an exception.  If so, here's a version that runs in plain
> racket that I find pretty easy to read.  It has the advantage that the
> 'return #f' parts aren't way far away from what causes them.
> 
> (with-handlers ([false? identity] ; return #f
> [any/c  raise])   ; re-raise everything else
>   (let* ([x (if (foo? x)
> x
> (raise #f))]
>  [z (jazz x (bar x))]
>  [a (if (loopy? z)
> (yowza z)
> (raise #f))]
>  [b (if (string? a)
> (bonkers a)
> (error 'ugh))])
> (if (number? (hoop x b))
> 'all-good
> (error 'um

Yes.  But different semantics if bar, yowza, and bonkers have side effects.
If they don't, they're quite equivalent.

-- hendrik

> 
> If instead you want to return the exn that comes from error instead of
> re-raising it then you can do that by removing the false? clause from the
> with-handlers.  NOTE:  You should re-raise exn:break since otherwise the
> user cannot ^C the program.
> 
> (with-handlers ([exn:break?  raise]
> [any/c   identity])
>   ...put the let* code here...)
> 
> -- 
> 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/CAE8gKodxas7jtze%2BttcFA%2BG0ATKUFZD3rhK%2B%3Dn2U1md1zQPJSg%40mail.gmail.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/20211001195320.4wtga4tjwgo75jhz%40topoi.pooq.com.


[racket-users] Racket meeting tomorrow?

2021-10-01 Thread Hendrik Boom
Is there going to be a Racket online meeting at the gather site tomorrow 
on October 2?  There have been on previous 
first-Saturdays-in-the-month.If so, at what time, and what's the URL?

-- hendrik

-- 
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/20211001164939.xrugfg7xlkj4pmfo%40topoi.pooq.com.


[racket-users] Re: Escape continuations for fussy code

2021-10-01 Thread Hendrik Boom
On Fri, Oct 01, 2021 at 02:22:14PM +, Jesse Alama wrote:
> Hello,
> 
> Have you ever wished you could do a C-style return in the middle
> of a block of Racket code? When you're in the heat of things with
> a complicated problem where input values need a fair amount of
> multi-stage extraction and validation, using cond quickly pulls
> code to the right. My procedure is:
> 
> * cond/case. In each branch:
> * Define some new values safe in the knowledge of where you are
> (extract) and perhaps check them, if necessasry (validate)
> * Make sure you have an else branch.
> * return to 1 and repeat as many times as necessary.
> 
> The result:
> 
> (cond [(foo? x)
> (define y (bar x))
> (define z (jazz x y))
> (cond [(loopy? z)
> (define a (yowza z))
> (cond [(string? a)
> (define b (bonkers a))
> (cond [(number? (hoop x b))
> (define ...)]
> [else
> (error 'um)])]
> [else
> (error 'ugh)])]
> [else #f])]
> [else #f])

the Racket package parendown (see 
https://docs.racket-lang.org/parendown/index.html ) can reduce this a 
lot:

(if (not #/ foo? x) #f
#/ begin
  (define y (bar z))
  (define z (jazz x y))
#/if (not #/ loopy? z) #f
#/ begin
  (define a (yowza z))
#/if (not (string a)) (error 'ugh)
#/begin
  (define b (bonkers a))
#/if (not (number? (hoop x b))) (error 'um)
  (define ...)
)

Or, using let instead of define

(if (not #/ foo? x) #f
#/ let ((y (bar z)))
#/ let ((z (jazz x y)))
#/ if (not #/ loopy? z) #f
#/ let ((a (yowza z)))
#/ if (not (string a)) (error 'ugh)
#/ let ((b (bonkers a)))
#/ if (not (number? (hoop x b))) (error 'um)
#/ let ((...))
  -- and presumably you wanted to do someting inside all there define's
)

Is this clearar?

There remain 
  * the ugly extra parentheses aroung each let-pair,
which is an unnecessary tradition once you use parendown,
and
  * the 'not's after the 'if's.
which could be resolved with a three-argument check operator:  
(check requirement errormessage stufftodoifok) -- essentially 
an argument-reversed if.

but this is enough to eliminate the push off the right side of the page.

A heuristic when programming this way:
  When a function takes several arguments, define it so that the 
  argument that is likely to be textually longer is at the end.

-- hendrik

> 
> That's an awful lot of whitespace. We're getting dragged to the
> right. Pretty soon we're dealing with lines that have three dozen
> spaces at the front or more.
> 
> At times, it can even get a bit silly just how deeply nested code
> can get. It can even degrade program comprehension for you &
> others. It can even impede your own coding by requiring you to
> scroll up to mentally re-construct the state you're in.
> 
> This isn't necessarily a problem with Racket. I think it reflects
> of the inherent fussiness of some problems. And certainly, you
> can reformat the code differently to make the problem somewhat
> less severe.
> 
> Nonetheless, I certainly have found myself envying those working
> in other languages where they can just bail out of a complicated
> computation by just returning a value. I mean, sure, I could
> raise an exception and bail out that way, right? It turns out
> there's a way: escape continuations. They permit a kind of
> C-style return-y programming in Racket. I've got an article (
> https://click.convertkit-mail.com/92u52qdvngtnh535n9s9/3ohphkhq39xwevtr/aHR0cHM6Ly9saXNwLnNoL2VzY2FwZS1jb250aW51YXRpb25zLWZvci1mdXNzeS1jb2RlLw==
> ) up introducing escape continuations and give a simple
> real-world example from web programming.
> 
> Happy hacking,
> 
> Jesse
> 
> Unsubscribe (
> https://unsubscribe.convertkit-mail.com/92u52qdvngtnh535n9s9 ) |
> Update your profile (
> https://preferences.convertkit-mail.com/92u52qdvngtnh535n9s9 ) |
> Moltkestrasse 3d, Mainz, RP 55118

-- 
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/20211001155821.hdbqgzfkn6gfjw67%40topoi.pooq.com.


Re: [racket-users] Fix linux (play-sound) sound output as aplay does not work, swap for something else

2021-08-24 Thread Hendrik Boom
On Tue, Aug 24, 2021 at 12:19:25PM -0700, jest array wrote:
> https://github.com/racket/gui/issues/239
> 
> So this does not work on both Arch Linux with prebuilt racket binaries and 
> Debian with built from source binaries(according to a user JSGRANT on the 
> racket discord server 
> https://discord.com/channels/571040468092321801/618895179343986688/879797867903057921):

Ten years ago I remarked that audio on Linux is a black art.  Ten years 
later, it is still a back art. 

-- hendrik

-- 
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/20210824193121.u7nlsexsiayl2j6b%40topoi.pooq.com.


Re: [racket-users] parenthesis colours

2021-07-05 Thread Hendrik Boom
On Mon, Jul 05, 2021 at 07:52:39AM -0500, Robby Findler wrote:
> Glad to hear it! Sorry the defaults looked bad.

They look pretty enough.  They just aren't useful.
I turned the parentheses bright yellow.
Unless yellow comflicts with some other use of the same colour,
may I recommend it ne made default?

-- hendrik

> 
> Robby
> 
> On Mon, Jul 5, 2021 at 7:02 AM Hendrik Boom  wrote:
> 
> > On Sun, Jul 04, 2021 at 08:18:24AM -0500, Robby Findler wrote:
> > > If you go to the preference dialog, choose "Colors", and then choose
> > > "Racket" you should be able to adjust each color independently.
> > >
> > > There are also some themes for DrRacket in dark mode that have different
> > > color schemes; I think Tol's is installed by default and there are more
> > on
> > > the pkg server.
> > (offlist)  Thank you.  Much. much better now.
> >
> > -- hendrik
> > >
> > > hth,
> > > Robby
> > >
> > >
> > > On Sun, Jul 4, 2021 at 7:26 AM Hendrik Boom 
> > wrote:
> > >
> > > > I use drracket in what I call night mode -- dark backgroun and bright
> > > > letters.
> > > > It's easier on the eyes,
> > > > except when I have to see parentheses.
> > > > They are presented in a dark shade of red.
> > > > Given how crucial parentheses are in Racket, this is an obstacle,
> > > > especially when the error-reporting mechanism highlights a part of the
> > > > code it thinks is in error -- using red highlighting, obscuring the
> > > > possibly unbalanced parentheses completely.
> > > >
> > > > Is it possible to set parenthese to be some other colour, such as, say,
> > > > a bright green or white?
> > > >
> > > > -- hendrik
> > > >
> > > > --
> > > > 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/20210704122648.hbztacmpzcjvc3hd%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 racket-users+unsubscr...@googlegroups.com.
> > > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/racket-users/CAL3TdOP7m7MsbRw8MDjevLuB5z9TDDp_AZCL5suTQbNJb9dujQ%40mail.gmail.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/20210705160659.fbyng6drfono7cow%40topoi.pooq.com.


[racket-users] parenthesis colours

2021-07-04 Thread Hendrik Boom
I use drracket in what I call night mode -- dark backgroun and bright 
letters.
It's easier on the eyes,
except when I have to see parentheses.
They are presented in a dark shade of red.
Given how crucial parentheses are in Racket, this is an obstacle,
especially when the error-reporting mechanism highlights a part of the 
code it thinks is in error -- using red highlighting, obscuring the 
possibly unbalanced parentheses completely.

Is it possible to set parenthese to be some other colour, such as, say, 
a bright green or white?

-- hendrik

-- 
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/20210704122648.hbztacmpzcjvc3hd%40topoi.pooq.com.


Re: [racket-users] Registered on irc.libera.chat

2021-05-24 Thread Hendrik Boom
On Mon, May 24, 2021 at 08:14:07AM +0200, Dominik Pantůček wrote:
> Hello,
> 
> I am always advocating for being cautious - rather than rushing into
> quick decisions (which may prove wrong later on). However, given known
> facts, the situation with Freenode won't probably change for any better
> in the foreseeable future.
> 
> I'd like to hear more opinions though before I (or anyone else) change
> the topic on Freenode to include information about "official" (whatever
> that means) channel being moved to libera.chat.

Experience in other channels indicates that saying you are moving to 
libera.chat will get the quick response of having your administrator 
privileges revoked and having that message deleted.

> 
> I am personally in favor of that.

Yes... but you'll have to do that on other channels we are still in 
control of -- such as websites and mailing lists to that everyone 
interested has a chance of getting the message.

Things seem to be getting worse on freenode.

If there are any achival messages on freenode (probably not, if I 
understand how IRC works), it would be good to do an off-freenode backup 
before announcing the switch.

And keep logging freenode channel activity until everyone has moved.

-- hendrik

> 
> 
> Cheers,
> Dominik
> 
> On 22. 05. 21 15:13, Tony Garnock-Jones wrote:
> > Hi all,
> > 
> > I just registered the Racket project on irc.libera.chat with ownership
> > of #racket and #racket-*.
> > 
> > Would those who have served as chanops on freenode who are willing to
> > also do the same for libera.chat please email me privately to let me
> > know your nick etc.?
> > 
> > Thanks!
> > 
> > Tony
> > 
> > -- 
> > 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/a3b34f89-10c9-4f14-915f-9622ca690e41n%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/2a0f4cf0-00e7-2569-a0d4-2f3cf4c5fbca%40trustica.cz.

-- 
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/20210524120719.x6ldh2yweeqohkt4%40topoi.pooq.com.


Re: [racket-users] Injecting local contracts for prefab constructors

2021-05-10 Thread Hendrik Boom
On Sun, May 09, 2021 at 10:23:34PM +, Sage Gerard wrote:
> I have a project with 57 prefab structure types. I need to construct 
> instances using a local contract (module level contracts do not fit my needs 
> here). Since I cannot define guards, the solution is easy enough.
> 
> (struct foo (num) #:prefab)
> (define/contract make-foo (-> real? foo?) foo)
> 
> Problem: I already have a few hundred constructor calls without 
> contracts. I could either A) rewrite them all to use contracted 
> constructors, or B) attach local contracts in a sweet spot so that I 
> don't have to rewrite anything else.

Is there any chance you could do the "rewriting" in a macro so you 
wouldn't actually have to change the few hundred constructor calls
when you use option A)?

-- hendrik

> 
> I prefer option B, but it doesn't look like I can attach a local contract to 
> a constructor with `struct` alone, or even with an impersonator. When I hack 
> around to rebind or hide the constructor's identifier, I break compatibility 
> with `match` and `defstruct*`.
> 
> If you were in my position, what would you do?
> 
> --
> 
> ~slg
> 
> -- 
> 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/0a16cfbe-4789-a939-796e-5f6f9da21626%40sagegerard.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/20210510110509.cpg6jnil6th7xbsi%40topoi.pooq.com.


Re: [racket-users] Typed Racket: type relations

2021-04-19 Thread Hendrik Boom
On Sun, Apr 18, 2021 at 09:05:11AM +0200, Dominik Pantůček wrote:
...
...
> 
> I would really like to be able to reason about the Integer bounds (and
> therefore signs) dynamically. So that when you have something like:
> 
> (: square (-> Fixnum Nonnegative-Fixnum))
> (define (square x)
>   (fx* x x))
> 
> You will get something better than:

> 
> multiplication.rkt:7:2: Type Checker: type mismatch
>   expected: Nonnegative-Fixnum
>   given: Fixnum
>   in: (fx* x x)
> 
> I will look into the refinements implementation to see what are the
> current limits and what the future possibilities might be.

Reading the documentation you link to, it seems that the problem is that 
(fx* x x) is not linear in x.
It says that it can reason only about linear expressions.  This is a 
quadratic form.

-- hendrik

...
...

-- 
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/20210419113103.c4fupxvl6ieb3uub%40topoi.pooq.com.


Re: [racket-users] Polished 3D package for some simulations

2021-04-12 Thread Hendrik Boom
On Sun, Apr 11, 2021 at 09:25:48PM -0500, Nathaniel W Griswold wrote:
> Thanks all, i’m just going to see if Pict3D works out. I didn’t know about it 
> before. I don’t really need textures for this project as i am starting with 
> just particles moving around and wave superposition.

It might work for you then.  It didn't for me.  And I spent a while trying to 
figure out how to attach textures, but the internals of Pict3d were too 
much for me.  Not enough internal documentation.  It was easier to use sgl 
directly, but I may someday have to go to serious solid modelling.

-- hendrik

> 
> Nate
> 
> > On Apr 8, 2021, at 2:59 PM, Hendrik Boom  wrote:
> > 
> > On Thu, Apr 08, 2021 at 11:22:10AM -0700, kamist...@gmail.com wrote:
> >> Have you tried out Pict3D [1]?
> > 
> > Two significant flaws with Pict3D:
> > 
> > * It does not have a mechanism for attaching a texture to an object.
> > 
> > * It does not allow one to cut one #D object out of another.
> >  (such as using a cylinder to drill a round hole in a block of wood)
> > 
> > Otherwise it's an impressive peve of work.
> > 
> >> There is also a library from Matthew Flatt that can create 3D Text / 
> >> extruded pathes: [2]
> >> 
> >> Personally I currently use opengl [3], these bindings support higher 
> >> opengl 
> >> versions than the [4]
> >> (which only support opengl 1.5 according to its documentation)
> >> 
> >> I can't say exactly up to which opengl version [3] has working bindings, 
> >> these bindings were automatically generated, but that stopped working at 
> >> some point.
> >> (Apparantly the input that was used for the generation isn't provided for 
> >> recent opengl versions anymore, so the generator has to be fixed or 
> >> replaced to work with a different input/description)
> > 
> > Exactly.  I've been struggling with this last year, and I sort of gave up.
> > I'm thinking of looking at it again.
> > 
> > What happened to the spec is that the entire thing has been recoded from a 
> > completely ad-hoc formalism to a slightly less ad-hoc XML-based formalism.
> > Everything is different.  And the new one is somewhat inconsistent about 
> > the placement of asterisks in the XML phrases that form function prototypes.
> > 
> > I've been using sgl for my own work.  I suspect it to be largely 
> > hand-coded, but it seems to work.
> > 
> > There's also a binding for Vulkan, which I don't think has been used vary 
> > much, and so may still pose surprises.
> > 
> >https://docs.racket-lang.org/vulkan/index.html
> > 
> > I don't know how well any of this works on a Mac, which I gather is going 
> > its own way for graphics, perhaps in the cause of incompatibility.
> > 
> > -- hendrik
> > 
> >> 
> >> [1] https://docs.racket-lang.org/pict3d/index.html
> >> [2] https://docs.racket-lang.org/pict3d-die-cut/index.html
> >> [3] https://docs.racket-lang.org/opengl/index.html
> >> [4] 
> >> https://docs.racket-lang.org/sgl/index.html?q=opengl#%28idx._%28gentag._0._%28lib._sgl%2Fscribblings%2Fsgl..scrbl%29%29%29
> >> 
> >> -- 
> >> 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/67072c79-aac7-40a1-8774-2d684c7476d1n%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/20210408195922.zdq5ruhr4ufvqgc4%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 racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20210412114648.hdgyxenl747epbhp%40topoi.pooq.com.


Re: [racket-users] Re: Polished 3D package for some simulations

2021-04-08 Thread Hendrik Boom
On Thu, Apr 08, 2021 at 11:22:10AM -0700, kamist...@gmail.com wrote:
> Have you tried out Pict3D [1]?

Two significant flaws with Pict3D:

* It does not have a mechanism for attaching a texture to an object.

* It does not allow one to cut one #D object out of another.
  (such as using a cylinder to drill a round hole in a block of wood)

Otherwise it's an impressive peve of work.

> There is also a library from Matthew Flatt that can create 3D Text / 
> extruded pathes: [2]
> 
> Personally I currently use opengl [3], these bindings support higher opengl 
> versions than the [4]
> (which only support opengl 1.5 according to its documentation)
> 
> I can't say exactly up to which opengl version [3] has working bindings, 
> these bindings were automatically generated, but that stopped working at 
> some point.
> (Apparantly the input that was used for the generation isn't provided for 
> recent opengl versions anymore, so the generator has to be fixed or 
> replaced to work with a different input/description)

Exactly.  I've been struggling with this last year, and I sort of gave up.
I'm thinking of looking at it again.

What happened to the spec is that the entire thing has been recoded from a 
completely ad-hoc formalism to a slightly less ad-hoc XML-based formalism.
Everything is different.  And the new one is somewhat inconsistent about 
the placement of asterisks in the XML phrases that form function prototypes.

I've been using sgl for my own work.  I suspect it to be largely 
hand-coded, but it seems to work.

There's also a binding for Vulkan, which I don't think has been used vary 
much, and so may still pose surprises.

https://docs.racket-lang.org/vulkan/index.html

I don't know how well any of this works on a Mac, which I gather is going 
its own way for graphics, perhaps in the cause of incompatibility.

-- hendrik

> 
> [1] https://docs.racket-lang.org/pict3d/index.html
> [2] https://docs.racket-lang.org/pict3d-die-cut/index.html
> [3] https://docs.racket-lang.org/opengl/index.html
> [4] 
> https://docs.racket-lang.org/sgl/index.html?q=opengl#%28idx._%28gentag._0._%28lib._sgl%2Fscribblings%2Fsgl..scrbl%29%29%29
> 
> -- 
> 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/67072c79-aac7-40a1-8774-2d684c7476d1n%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/20210408195922.zdq5ruhr4ufvqgc4%40topoi.pooq.com.


Re: [racket-users] fluent: unix style pipes and lambda shorthand to make your code more readable

2021-03-10 Thread Hendrik Boom
On Wed, Mar 10, 2021 at 08:23:46PM +0700, Roger Keays wrote:
> > I've been using the Clojure-like threading package for a while now and this 
> > has
> > some nice advantages that are mentioned in the docs, like blending the first
> > arg > and last arg >> variants easily in a sequence.
> > 
> > How does fluent manage this infixing from a (require ...) rather than a 
> > #lang?
> 
> It provides a custom #%app macro which rearranges the code into regular 
> s-expressions. I was surprised by how much flexibility this feature of racket 
> gives you. It would have taken months to build this from scratch in any other 
> language. The racket version is 25 lines of code. [1]
> 
> > It might be nice to use ~> and ~>> (or |> and |>> or choose your own) as 
> > infix
> > to avoid clashing with >.
> 
> I wanted a single character because I use it so often. I suppose with the 
> unicode (→) option, there is less need for a single-character solution. Need 
> to think about this...

Only if your keyboard has a convenient single key to type it with.

-- hendrik

> 
> 
> [1] https://github.com/rogerkeays/racket-fluent/blob/main/main.rkt
> > 
> > 
> > Dan
> > 
> > --
> > 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/
> > CAFKxZVVBV1sP%2BKk%2B%2Bdw7k7a_TcEsL-yz6%2BLKDLZOa2Wfc1RAYw%40mail.gmail.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/sigid.0703ba7d55.20210310132341.GA3081%40papaya.papaya.

-- 
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/20210311003108.qjqsrn4kd6nbwtd5%40topoi.pooq.com.


Re: [racket-users] public email addresses on packages server

2021-02-23 Thread Hendrik Boom
On Sat, Feb 20, 2021 at 11:47:19PM +0700, Roger Keays wrote:
> Has any consideration been given to concealing email addresses on 
> pkgs.racket-lang.org for privacy purposes?

Aren't those email addresses available anyway from github?

-- hendrik

-- 
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/20210223171932.ljgqq77qb5b7wjin%40topoi.pooq.com.


[racket-users] flomat -- possible typo in documentation

2021-02-23 Thread Hendrik Boom
On Mon, Feb 22, 2021 at 10:26:09PM -0800, Rohan Posthumus wrote:
> > Just in case you haven't found them already, if you need matrices over 
> > real floating points,
> > take a look at:
> >
> > https://docs.racket-lang.org/manual-flomat/index.html

Looked at that.

On 
https://docs.racket-lang.org/manual-flomat/index.html#%28part._.Matrix_.Creation%29

it says

> (sub! A i j m n)
> Same as sub, but the elements are copied - the underlying array of flonums 
> are shared.

Presumably it should say "are not copied".

-- hendrik

-- 
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/20210223133908.xyj5ndwpmwpsf4kh%40topoi.pooq.com.


[racket-users] [Funny] Package server registration/reset email code flow changed

2021-02-18 Thread Hendrik Boom
Funny.  Thus message about Racket paskages arrived immediately after a 
message from the post office ttiled:
Tips for receiving and sending packages
telling me how to register an alternative package destination in case 
I'm no thome.

So when I got this message, titled
Package server registration/reset email code flow changed
my immediate reaction was,
   No! they don't mean that kind of packages.

-- hendrik

On Thu, Feb 18, 2021 at 08:48:56PM +0100, Tony Garnock-Jones wrote:
> Hi all,
> 
> Just to let you know I updated the package server to have a slightly
> different flow for password resets and account registrations, for spam
> prevention reasons. Please reply here or email me directly at
> to...@leastfixedpoint.com if you have any trouble.
> 
> Regards,
>   Tony
> 
> -- 
> 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/9b8b3c0c-0d37-d051-fc68-9438ed670d68%40leastfixedpoint.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/20210218213404.x6623s2kzjo2mw2x%40topoi.pooq.com.


Re: [racket-users] Racket v8.0 (!)

2021-02-17 Thread Hendrik Boom
On Tue, Feb 16, 2021 at 09:24:59PM -0500, 'John Clements' via Racket Users 
wrote:
> I think your 32-bit options at this point are these:
> 
> 1) Use one of the nightly builds, e.g. 
> https://plt.cs.northwestern.edu/snapshots/
> 2) Compile it yourself, using the source bundle.
> 3) (Of course, you could use an older version. Looks ilke 7.3 is the last one 
> released in a 32-bit Linux build.)
> 
> Let me know if I’ve forgotten any other options!

It looks as if there's no Racket on Chez for 32-bit Linux, though there does 
seem to be one on Windows.

-- hendrik

> 
> John
> 
> > On Feb 16, 2021, at 15:27, Hendrik Boom  wrote:
> > 
> > On Tue, Feb 16, 2021 at 12:26:50PM -0500, John Clements wrote:
> >> Help me out: which platform are you referring to?
> > 
> > The Linux one that was on everybody's PC before PC's went 64-bit.
> > I still use that old computer now and then with a stable 
> > Devuan release, especially when I'm on the move.
> > (though normally at home I have a 64-bit one).
> > 
> > -- hendrik
> > 
> >> 
> >> John
> >> 
> >>> On Feb 16, 2021, at 8:10 AM, Hendrik Boom  wrote:
> >>> 
> >>> On Sat, Feb 13, 2021 at 09:17:26PM -0500, 'John Clements' via Racket 
> >>> Users wrote:
> >>>> *** Racket 8.0 is here! ***
> >>>> 
> >>>> Racket version 8.0 is now available from
> >>>> 
> >>>>   https://racket-lang.org/
> >>> 
> >>> Are there no 32-bit intel binaries available?
> >>> Or did I just look too soon?
> >>> 
> >>> -- hendrik
> >>> 
> >>> -- 
> >>> 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/20210216161016.vtmuiws3m3b7mhed%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 racket-users+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/racket-users/20210216232741.fnc7dabmw65niisa%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 racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/63554058-a655-441b-b6f3-dbd7471b519d%40mtasv.net.

-- 
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/20210217223104.fwlkikyf7na4gaow%40topoi.pooq.com.


Re: [racket-users] Racket v8.0 (!)

2021-02-16 Thread Hendrik Boom
On Tue, Feb 16, 2021 at 12:26:50PM -0500, John Clements wrote:
> Help me out: which platform are you referring to?

The Linux one that was on everybody's PC before PC's went 64-bit.
I still use that old computer now and then with a stable 
Devuan release, especially when I'm on the move.
(though normally at home I have a 64-bit one).

-- hendrik

> 
> John
> 
> > On Feb 16, 2021, at 8:10 AM, Hendrik Boom  wrote:
> > 
> > On Sat, Feb 13, 2021 at 09:17:26PM -0500, 'John Clements' via Racket Users 
> > wrote:
> >> *** Racket 8.0 is here! ***
> >> 
> >> Racket version 8.0 is now available from
> >> 
> >>https://racket-lang.org/
> > 
> > Are there no 32-bit intel binaries available?
> > Or did I just look too soon?
> > 
> > -- hendrik
> > 
> > -- 
> > 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/20210216161016.vtmuiws3m3b7mhed%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 racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20210216232741.fnc7dabmw65niisa%40topoi.pooq.com.


Re: [racket-users] Racket v8.0 (!)

2021-02-16 Thread Hendrik Boom
On Sat, Feb 13, 2021 at 09:17:26PM -0500, 'John Clements' via Racket Users 
wrote:
> *** Racket 8.0 is here! ***
> 
> Racket version 8.0 is now available from
> 
> https://racket-lang.org/

Are there no 32-bit intel binaries available?
Or did I just look too soon?

-- hendrik

-- 
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/20210216161016.vtmuiws3m3b7mhed%40topoi.pooq.com.


[racket-users] Coordinates in draw and pict

2021-02-06 Thread Hendrik Boom
How are the coordinate systems in draw and pict related?
I suspect that one step in the pict coordinates aren't necessarily one 
step in the draw coordinate system. 

Is this so?  Do the various scaling operators in pict do their own 
scaling instead of delegating it to draw?

-- hendrik

-- 
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/20210207024936.q52lbkvqsjgshivf%40topoi.pooq.com.


Re: [racket-users] Racket v7.9.0.900 is available for testing

2021-01-22 Thread Hendrik Boom
On Fri, Jan 22, 2021 at 02:49:44PM -0500, 'John Clements' via Racket Users 
wrote:
> Hello, most excellent Racket Users!
> 
> Version 7.9.0.900 is now available for testing from
> 
>   https://pre-release.racket-lang.org/
> 
> (Note that this is not available from the usual download site.)
> 
> If all goes well, we will turn this version into a v8.0 release
> within a couple of weeks.
> 
> Your help and feedback in testing this new release candidate would be
> much appreciated.
> 
> 
> Please note that although the last few releases have included variants that 
> used the Chez Scheme back-end, this is the first one for which it’s the 
> default. The old back-end is now labeled as “BC” (“before chez”) on the 
> pre-release download page.
> 
> Many thanks!
> 
> John Clements

Are there instructions for installation?  (Either to coexist with an 
existing Racket, or to replace it) 

-- hendrik

> 
> -- 
> 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/ce4add22-6c19-4860-a249-36a52c94227a%40mtasv.net.

-- 
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/20210123025857.clmin55k7n73vucc%40topoi.pooq.com.


Re: [racket-users] Moving a Rust/Haskell abstract algebra library to Racket?

2021-01-21 Thread Hendrik Boom
On Wed, Jan 20, 2021 at 08:06:45PM -0800, Stuart Hungerford wrote:
> On Thursday, 21 January 2021 at 10:22:45 UTC+11 Jens Axel Søgaard wrote:
> 
> Den ons. 20. jan. 2021 kl. 08.43 skrev Stuart Hungerford <
> > stuart.h...@gmail.com>:
> >
> >> On Wednesday, 20 January 2021 at 12:34:59 UTC+11 Robby Findler wrote:
> >>
> >> I'm no expert on algebras, but I think the way to work on this is not to 
> >>> think "what Racket constructs are close that I might coopt to express 
> >>> what 
> >>> I want?" but instead to think "what do I want my programs to look like" 
> >>> and 
> >>> then design the language from there, reusing libraries as they seem 
> >>> helpful 
> >>> or designing new ones that do what you want. Racket's 
> >>> language-implementation facilities are pretty powerful (of course, if 
> >>> there 
> >>> is nothing like what you end up needing, there will still be actual 
> >>> programming to do ;).
> >>>
> >>
> >> Thanks Robby -- that's a very interesting way to look at library design 
> >> that seems to make particular sense in the Racket environment.
> >>
> >
> > An example of such an approach is racket-cas, a simple general purpose 
> > cas, which
> > represents expressions as s-expression. 
> >
> > The polynomial 4x^2 + 3 is represented as '(+ 3 (* 4 (expt x 2))) 
> > internally.
> >
> > The expressions are manipulated through pattern matching. Instead of
> > using the standard `match`, I wanted my own version `math-match`.
> > The idea is that `math-match` introduces the following conventions in 
> > patterns:
> >
> 
> This is also fascinating (and very useful) -- thanks.  This package 
> illustrates the build-your-own-notation approach nicely.
> [...]
> 
> > Back to your project - what is the goal of the project?
> > Making something like GAP perhaps?
> > Do you want your users to supply types - or do you want to go a more 
> dynamic route?
> 
> My project is really aimed at supporting self-directed learning of concepts 
> from abstract algebra. I was taught many years ago that to really 
> understand something to try implementing it in a high level language. That 
> will soon expose any hidden assumptions or misunderstandings.
> 
> An early attempt (in Rust) is at: https://gitlab.com/ornamentist/un-algebra
> 
> By using the Rust trait system (and later Haskell typeclasses) I could 
> create structure traits/typeclasses that don't clash with the builtin 
> numeric types or with the larger more production oriented libraries in 
> those languages in the same general area of math.
> 
> Once I added generative testing of the structure axioms I could experiment 
> with, e.g. finite fields and ensure all the relevant axioms and laws were 
> (at least probabilistically) met.
> 
> Thanks again Jens.

You might also want to look at the implementations of category theory in Agda.
Agda is a language which unifies execution and correctness proof to some 
extent. 

Not that you want to implement catagory theory, but category theory is a 
form of algebra, and you may find some useful ideas about syntax and 
semantics there.

I attended an online seminar about this recently, but I haven't been 
able to find the details again.  The following links seem to refer to the 
same project.  (I found them looking for
category theory in agda
on duckduckgo.

The software:
https://github.com/agda/agda-categories

Documents:
  Formalizing Category Theory in Agda  
pdf: https://arxiv.org/pdf/2005.07059.pdf
slides: https://hustmphrrr.github.io/asset/slides/cpp21.pdf

Agda itself is also worth a look.
As well as older proof assistants like coq.

There's definitely a trand towards constructivism in foundational 
mathamatics.

-- hendrik

> Stu
> 
> 
> -- 
> 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/b14e56eb-71ef-49f4-8e98-fea4ced6e3adn%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/20210121135543.qi2rth7qkhlasrcc%40topoi.pooq.com.


Re: [racket-users] Can someone please override the Reply-To so that normal replies go to the list?

2021-01-01 Thread Hendrik Boom
On Fri, Jan 01, 2021 at 10:56:01PM +, Sage Gerard wrote:
> > "Proper mail systems" "Now you know the reason" grrr g!
> 
> Relax, I come in peace.
> 
> Clients aren't created equal. I don't have a "reply to list" button.
> I have "Reply" and "Reply All". I went through some settings to see
> if there's a way to enable the feature, but no luck.
> 
> I do, however, have other features that keep me on this client.
> I don't expect the list to change their settings for the sake of one
> client any more than others would expect me to change clients for the
> sake of a list. That's why this is only a request.
> 
> Going off Dominick's email, it would help to at least make sure the list 
> appears
> in "To:" and not "Cc:", because then users of improper mail systems like me 
> can
> quickly backspace out the individual recipients. As it stands now each of my 
> replies
> has to re-addressed from scratch. I would think that in most cases, the 
> typical
> behavior is to reply to the list and the exceptional behavior is to go off 
> list.
> If that's true, is there something wrong with making the default behavior
> more accessible to more clients?

It *is* possible to list more than one recipient in the To line.

-- hendrik

> 
> 
> ~slg
> 
> ‐‐‐ Original Message ‐‐‐
> On Friday, January 1, 2021 2:16 PM, Hendrik Boom  
> wrote:
> 
> > On Fri, Jan 01, 2021 at 04:31:56PM +, Sage Gerard wrote:
> >
> > > The Reply-To experience for this list seems wrong.
> > > Clicking normal "Reply" sets the reply to the person who last sent an 
> > > email to the thread, but not the list address.
> > > Clicking "Reply All" sends a copy of the email to an increasingly larger 
> > > list of people, with the mail list CC'd. The extra copies can be annoying 
> > > for some, but it's a pain to manually edit the email recipients every 
> > > time such that only the user list is in the To: field.
> >
> > Proper mail systems use "reply to" indicate that the sender is sending
> > from a location that is not where he wants to receive email. This might
> > be because he is, for example, temprarily away from home.
> >
> > "Reply all" is indeed to send to everybody nvilved in the message.
> >
> > Proper mail systems also provide a command "reply to list". The proper
> > fix is to make sure your mail system supports reply to list.
> >
> > > Unless there's a reason to keep it this way, can the email list admin 
> > > please see if this thread's solution still works for making Reply-To 
> > > default to us...@racket-lang.org? 
> > > https://support.google.com/a/thread/11037574?hl=en
> >
> > Now you know the reason. It makes it possible to reply to the original
> > author where he can receive email, and independently to reply to the
> > list.
> >
> > -- hendrik
> 
> 
> -- 
> 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/wHFPsnmmC6fVox7fAvgcYXatz5UhF7ywcCqyAt3TfUfOoa3Yy6mx_-hNW7oPlsDMCp41NDfeJAMZJW66bmnLJ20meRrocoiEwWdseqabBZk%3D%40sagegerard.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/20210102002255.hbvqcqhd6qmdp4ij%40topoi.pooq.com.


Re: [racket-users] Can someone please override the Reply-To so that normal replies go to the list?

2021-01-01 Thread Hendrik Boom
On Fri, Jan 01, 2021 at 10:53:14PM +0100, Dominik Pantůček wrote:
> 
> > 
> > Proper mail systems also provide a command "reply to list".  The proper 
> > fix is to make sure your mail system supports reply to list.
> > 
> 
> Which seems to work only if the list is in the "To:" header - not "Cc:".
> At least that is how my Thunderbird apparently works...

The mailing list is identified in the following headers:

Precedence: list
Mailing-list: list us...@plt-scheme.org; contact users+own...@plt-scheme.org
List-ID: 

But when I just tried reply-to-list on the message I'm replying to, all 
I was told was 
No mailing lists found!

So evidently something isn't working properly here, either; even though 
I do have a reply-to-list function.

Is there something else subtly wrong with the mail headers?  Or do I 
have to do something weird to mutt to get it to behave?

-- hendrik

> 
> 
> Dominik
> 
> -- 
> 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/07891d54-d5e6-a9de-9165-7a82488a1dc8%40trustica.cz.

-- 
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/20210102001958.b3fnmi7qvzr6guiq%40topoi.pooq.com.


Re: [racket-users] Can someone please override the Reply-To so that normal replies go to the list?

2021-01-01 Thread Hendrik Boom
On Fri, Jan 01, 2021 at 04:31:56PM +, Sage Gerard wrote:
> The Reply-To experience for this list seems wrong.
> 
> Clicking normal "Reply" sets the reply to the person who last sent an email 
> to the thread, but not the list address.
> 
> Clicking "Reply All" sends a copy of the email to an increasingly larger list 
> of people, with the mail list CC'd. The extra copies can be annoying for 
> some, but it's a pain to manually edit the email recipients every time such 
> that only the user list is in the To: field.

Proper mail systems use "reply to" indicate that the sender is sending 
from a location that is not where he wants to receive email.  This might 
be because he is, for example, temprarily away from home.

"Reply all" is indeed to send to everybody nvilved in the message.

Proper mail systems also provide a command "reply to list".  The proper 
fix is to make sure your mail system supports reply to list.

> 
> Unless there's a reason to keep it this way, can the email list admin please 
> see if this thread's solution still works for making Reply-To default to 
> us...@racket-lang.org? https://support.google.com/a/thread/11037574?hl=en

Now you know the reason.  It makes it possible to reply to the original 
author where he can receive email, and independently to reply to the 
list.

-- hendrik

-- 
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/20210101191620.ph5cwa3lrw7apkdo%40topoi.pooq.com.


Re: [racket-users] Racket and Assembly

2020-12-30 Thread Hendrik Boom
On Wed, Dec 30, 2020 at 02:44:35PM -0500, Matt Jadud wrote:
> Hi Daniel,
> 
> As a start to answering your question(s), you might try the 2019 ICFP
> experience report on rebuilding Racket on top of Chez Scheme is probably a
> good place to look.
> 
> https://www.cs.utah.edu/plt/publications/icfp19-fddkmstz.pdf
> 
> This will give you an overview of the architecture of the language/runtime,
> and should serve as a starting point for additional questions.
> 
> Cheers,
> Matt

There is an implementation that was designed to compile straight to C:
  Gambit.
You can also use it to compile to C++ if you need to.

It has mechanisms that allow you, if you wish, to specify how entities 
you define will be translated.  (I strongly suspect that these 
mechanisms are used in its implementation).

This makes it useful as a kind of scripting language on top of C.

These mechanisms are not available in its interpreter.

Have fun exporing it.  It does not have as extensive a set of libraries 
as Racket does.

Someone has even managed to make a PC boot directly into the Gambit 
interpreter, without an intervening OS.

-- hendrik

> 
> 
> On Wed, Dec 30, 2020 at 2:10 PM Daniel Santos 
> wrote:
> 
> > Hi.
> >
> > I really want to know is if Racket compiles code directly into assembly?
> > Or does it do: Racket -> C -> Assembly ? Or something else ?
> >
> > Thank you
> >
> > --
> > 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/CAL6VdkStOUmBoWb%3DD3cgVpGnDaZ2mHKoPHbzy4U8Yjq%2BkxTVwg%40mail.gmail.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/CAAGM457ige6J-EsnSSHF7Fuv3Vc9DxF%3DK9jdqP23%3DWyDkgZ5Yg%40mail.gmail.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/20201230231031.lmmzqqxfq5zv7ygv%40topoi.pooq.com.


[racket-users] Split-pane editing

2020-12-29 Thread Hendrik Boom
When editing code in emacs, I oftern split the pane so I have views on two 
parts of a 
file.
Typically, this is so I can see a function definition in one pane at the same 
time as I  
see a corresponding function application in another pane.
Sometimes, this escalates to three panes.

Is there any way to do something similar in drracket?

-- hendrik

-- 
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/20201229225319.jtxd73vfv4zxok2j%40topoi.pooq.com.


Re: [racket-users] Towards an Incremental Racket Parser for better IDE experience?

2020-12-14 Thread Hendrik Boom
On Mon, Dec 14, 2020 at 04:43:24PM -0700, William G Hatch wrote:
> On Wed, Dec 02, 2020 at 01:56:41PM -0500, Sam Tobin-Hochstadt wrote:
> > A few thoughts on these topics, which I've been thinking about for a while.
> > 
> > First, let's distinguish two things. One is an _incremental_ system,
> > such as a parser, which is one which does less work in response to a
> > small change than it would need to do from scratch. The other is a
> > system with _error recovery_, which is one where in the presence of
> > one error, the system can still provide a useful answer and/or
> > continue on to discover other errors. tree-sitter, for example, aims
> > to do both of these, but they're quite different.
> 
> 
> I thought I might as well chime in here that I'm currently working on
> an incremental parsing system for Racket that will support parser
> combinators, BNF, and arbitrary ad-hoc parsing procedures.  I already
> have a parsing system[1] that supports expressive parsing with any mix
> of those constructors that supports all context-free grammars and
> beyond, so that much is already “successful”.  Unfortunately, I
> haven't been able to make it as performant as I would like.  The
> original goal wasn't to support incremental parsing, and I didn't
> write incremental support into that implementation.  However, while
> trying to optimize it I also decided to figure out how to make it
> incremental, so now I have the solution for that too.
> 
> I'm now working on another similar parsing system that is a little
> less expressive (in particular it has more limited support for
> ambiguous grammars, and thus doesn't support the full class of
> context-free grammars, though it will still support useful things
> outside of CFG, such as non-CFG things that Racket and Scribble
> parsers do), but should be much faster (because it gets to avoid extra
> work supporting the possibility of ambiguity).  I'm adding my solution
> to incremental parsing support to this version.  If I can ever make
> the original algorithm faster I'll add incremental support to it too.
> Both systems leverage delimited continuations at their core -- it
> turns out they are really useful for parsing, both for improving
> expressiveness and for incrementality.
> 
> That said, I'm not currently aiming to solve the error recovery part
> of the problem.

Error recovery on reparsing??  Just use the parse you had from the
last good parse, but mark the parse tree where it doesn't match
the parsed string.

-- hendrik

> 
> [1] https://github.com/willghatch/racket-chido-parse
> 
> -- 
> 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/20201214234324.GA13213%40conspirator.

-- 
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/20201215043507.fy6qf3boykhfcatp%40topoi.pooq.com.


Re: [racket-users] compose in Typed Racket

2020-12-10 Thread Hendrik Boom
On Wed, Dec 09, 2020 at 10:16:16PM -0800, unlimitedscolobb wrote:
> On Wednesday, December 9, 2020 at 11:50:26 PM UTC+1 Ben Greenman wrote:
> 
> > > If the answer is no, is there any interest in including these three 
> > > functions (as well as compose-5, 6, 7, 8) into Typed Racket? 
> >
> > I think these would be excellent in a package. 
> >
> > A package for compose-n and compose-3 to like 10 or 20?
> 
> I'm still not sure about how high the granularity of packages may get in 
> Racket, but I'd like to share these functions, because they feel very 
> useful to me.
>  
> 
> > Someday later, perhaps poly dots and #:rest-star can combine to 
> > improve the built-in type. 
> >
> 
> >From my naive viewpoint, I don't really see other natural ways of improving 
> the type of compose other than what I wrote, the problem being that writing 
> the type for arbitrary-arity composition would require specifying equality 
> between the return type of every function and the argument type of the 
> preceding one.  I'm not sure even Coq and Agda have that facility directly, 
> certainly not Haskell or Idris to the best of my knowledge.  I don't expect 
> them to go beyond binary compose, because it's sufficient to do any 
> compositions.  It's that in Racket I find writing chains of nested compose 
> calls somewhat clunky.
> 
> I'm not sure whether macros could be of use here.  I'll give it a think.

Idea:  Have a look at parendown 
https://docs.racket-lang.org/parendown/index.html

It would let you write
  (compose f 
(compose g
  (compose h k)))
as
  (  compose f
  #/ compose g
  #/ compose h k
  )

Which at least cuts down on the heavy indentation and parenthesis pile-up.

A macro might be able to generate either of the above from 
  (comp f g h k)
.

-- hendrik

> 
> -
> Sergiu
> 
> -- 
> 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/d0eacc64-c11b-4edd-aa38-c62c15494c06n%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/20201210164936.elqk6qsc76yhn4wc%40topoi.pooq.com.


Re: [racket-users] I‘m new to racket, i want to know the best resources of learning racket

2020-12-03 Thread Hendrik Boom
On Thu, Dec 03, 2020 at 02:19:43AM -0800, Yi Chen wrote:
> Any suggestions? Thanx for you guys

When my eldest started learning Racket, she had an introduction that 
early on, had her doing an animation of a rocket taking off.  She then 
changed it to do other things with the rocket.  Fun.

I thought that was a draft of HtDP, but I cannot find it any more.  Is 
that set of instructions still available?  If so, where?

It seems to be the right almost-first program for someone who is 
interested in writing computer games.

-- hendrik
 
> 
> -- 
> 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/0968f9d2-e546-4908-b744-a7e26e5a7ed1n%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/20201203215811.yqedqg5yfo6ve6jj%40topoi.pooq.com.


Re: [racket-users] I‘m new to racket, i want to know the best resources of learning racket

2020-12-03 Thread Hendrik Boom
On Thu, Dec 03, 2020 at 02:19:43AM -0800, Yi Chen wrote:
> Any suggestions? Thanx for you guys

Start with How To Design Programs., which is available as a free .pdf.
By the time that bores you, you'll likely have found other resources.

-- hendrik

> 
> -- 
> 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/0968f9d2-e546-4908-b744-a7e26e5a7ed1n%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/20201203215330.g4mclsyt5vrhqoqs%40topoi.pooq.com.


[racket-users] compiler books

2020-11-27 Thread Hendrik Boom
On Wed, Nov 25, 2020 at 09:46:21AM -0600, Tim Meehan wrote:
> Hi George, thanks for the reply!
> 
> I work a bit with hardware, but I'm not terribly good with assembly. I know
> enough about hardware to know how hard this must be to get working - but it
> does interest me a lot. The more I learn, the more respect I have for the
> tools available.
> 
> I guess for self-hosting, there are a couple of examples I could look at
> (raco exe, chez-exe, etc).
> 
> I had considered working through Build Your Own Lisp
> , Lisp in Small Pieces, Scheme from Scratch or
> something similar. Attempting self-study of the dragon book
> , or perhaps a lighter introduction
> if anyone has one they like.

I found a book by Dick Grune et al to be somewhat lighter than the dragon 
book.  Looking online, I discoered I was thinking of the first edition.  I 
haven't seen the second edition, but I'd guess the second edition would be 
similar, though it has rather more material:

https://dickgrune.com/Books/MCD_1st_Edition/
https://dickgrune.com/Books/MCD_2nd_Edition/

When I saw the first edition, I decided that if I were teaching an 
introductory course in compilers, I would use it as textbook.

And there's a lot of other interesting material on that web site.

-- hendrik

> 
> On Tue, Nov 24, 2020 at 11:26 PM George Neuner  wrote:
> 
> >
> > On 11/24/2020 7:34 PM, Tim Meehan wrote:
> >
> > Some Schemes allow you to compile to a (self-hosting?) executable (Chicken
> > {via C}, Chez, Racket, others?). Some do not (Guile, others?), but compile
> > to bytecode.
> >
> > Why would a group of developers choose one over the other? Or is the end
> > result not that different in either case?
> >
> >
> > The reason for creating stand-alone executables is to be able to run
> > programs in environments where the language tools are not, or cannot be,
> > installed.  For security reasons, many companies do not permit installing
> > programming tools.
> >
> > However, creating stand-alone executables is rather unrelated to what the
> > compiler produces.  There are a number of language implementations - Racket
> > included - which can embed their bytecode (as static data) into a native
> > "runtime" program which executes it.
> >
> > Is there a book/paper that I might read on this?
> >
> >
> > Unfortunately, language implementation is a very large subject area.  If
> > you want to understand why things are being done a certain way, you need to
> > understand the ways that they *could be* done and what trade-offs are
> > involved in using various methods.
> >
> > Little understood fact:  all languages actually are defined by a *virtual*
> > abstract machine.  This is the reason that languages can be implemented on
> > many different real-world CPUs:  it is the abstract machine that defines
> > the language's behavior, and it is the abstract machine - not some CPU -
> > that is the *real* compilation target.
> > [For those about to object: yes, Scheme has a formal denotational
> > definition in contrast to the many languages that are operationally defined
> > by (relatively) informal description of behavior combined with a
> > "reference" implementation.  Consider that Scheme's denotational spec is
> > describing the behavior of an abstract machine, and that Scheme
> > implementations are realizations of the machine.]
> >
> > To get a sense of what is going on under the hood, you need to learn a bit
> > about hardware, and a lot about compilers and interpreters.  Particular
> > language features often can be implemented in multiple ways, and the
> > choices made for various features often affect how harmoniously they can
> > coexist.
> >
> > If you really are serious about learning this stuff, I'm sure we can keep
> > you busy reading for a while.
> >
> > Cheers,
> > Tim
> >
> >
> > George
> >
> 
> -- 
> 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/CACgrOxLR%2BYRaG8BuUh54cuykfqDNKvzW-YuQ7CHCNr-1xHYe_w%40mail.gmail.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/20201127174016.pc2zlvjj6lc4nyaj%40topoi.pooq.com.


[racket-users] Historical note.

2020-11-08 Thread Hendrik Boom
On Sun, Nov 08, 2020 at 12:47:11PM -0800, unlimitedscolobb wrote:
> Thank you for you answer!  I'll need to think more about it.  The idea of 
> having structs whose fields contain functions has never occurred to me, but 
> it may actually fit my relatively simple use case (and the planned 
> migration to Typed Racket).

Historical note:

I first encountered structures containing function in the source code for
OS/360 way back in the late 60's.  In assembler.

-- hendrik

-- 
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/20201108215826.sxdlxmult3teo6a3%40topoi.pooq.com.


Re: [racket-users] Help implementing an early return macro

2020-10-28 Thread Hendrik Boom
On Wed, Oct 28, 2020 at 03:54:29AM -0700, Jack Firth wrote:
> So I'm a little tired of writing code like this:
> 
> (define x ...)
> (cond
>   [(take-shortcut? x) (shortcut x)]
>   [else
>(define y (compute-y x))
>(cond
> [(take-other-shortcut? x y) (other-shortcut x y)]
> [else
>  (define z ...)
>  (cond ...)])])

Perhaps you could use parendown
https://docs.racket-lang.org/parendown/index.html 

#lang parendown racket/base
(define x ...)
(cond
  [(take-shortcut? x) (shortcut x)]
  #/ else
  (define y (compute-y x))
  #/ cond
  [(take-other-shortcut? x y) (other-shortcut x y)]
  #/ else
  (define z ...)
  #/ cond ...
)

> 
> That is,
Frequently the lase element of a list is another list, and a large one 
at that.
Using #/ makes that a kind of tail-recursive syntax and eliminates some 
explicit parentheses.

Of course when you start using this it becomes so common that you'd like
to drop the ugly #'s, but unfortunately, / is already taken.

-- hendrik

-- 
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/20201028134830.54plnv6nv5j3lcmt%40topoi.pooq.com.


Re: [racket-users] garbage collection

2020-10-25 Thread Hendrik Boom
On Sun, Oct 25, 2020 at 04:41:41PM -0400, 'John Clements' via Racket Users 
wrote:
> It depends a lot on what you mean by a “Lisp-y” language. I’m certainly not 
> going to disagree with the sentiments expressed in the stack overflow post 
> that Dan Prager posted… after all, I wrote the top-posted one! You’re asking 
> a question about persuading a co-worker, though. In my opinion, the best line 
> of argument to use with people like this is that you could be trading CPU 
> time against human developer time. I think it’s moderately non-controversial 
> to suggest that writing code in languages without a garbage collector creates 
> new opportunities for things to break, and therefore incurs a higher 
> development and maintenance cost. If the software is going to be run enough, 
> then maybe you can make an argument that the tradeoff is worth it. If it’s 
> not on a critical path, though, then reducing development time is probably 
> the better choice.
> 
> In my opinion, moving the discussion up one level (cost benefit analysis) 
> reduces the opportunity for banging heads on the merits of garbage collection 
> itself.
> 
> And, with that said, changing peoples’ minds is generally impossible.

The big question is:

   Is this a program where short pauses would be critical?

If not, you can afford a garbage collector.
If so, you should use a language without a garbage collector, perhaps Rust,
or else not have any tricky data structures that have to be freed.

P.S.  If the lists are noncircular, reference counting works.  Provided 
your languages manages it properly.  I suspect Rust does.  Limbo uses it 
as the preferred means for garbage collection, with a regular garbage 
collector as a backup, needed only when there are lost circular lists.

-- hendrik

> 
> John
> 
> 
> > On Oct 25, 2020, at 10:10, Tim Meehan  wrote:
> > 
> > I'm in a very small programming operation, and I am trying to get my 
> > co-workers to try out Racket, or at least tolerate some of the tools being 
> > written in Racket. One of them has a very simple decision tree that he uses 
> > to evaluate programming languages: "does it have a garbage collector?", if 
> > yes, reject ...
> > 
> > It doesn't seem to be a speed thing, it seems to be that he is convinced 
> > that the designers of the garbage collectors look for bad times to go to 
> > work and screw up what he's doing. (You guys don't do that, right? )
> > 
> > It got me thinking though - is it possible to run modern Lisp-y languages 
> > without a garbage collector? Is it even smart to try? I know that there 
> > must be a trade off, I just didn't know enough about what was traded off to 
> > explain it to him.
> > 
> > -- 
> > 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/CACgrOxLZXa%2BLUhX4sWbdg8PtjnoiSw_yeSDMg7OoV9HSEMRweA%40mail.gmail.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/22ce3dfa-b2bb-4484-a43f-ff190461fbdb%40mtasv.net.

-- 
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/20201025210826.vhanbgcjs77qrkea%40topoi.pooq.com.


Re: [racket-users] Re: hashcons

2020-09-14 Thread Hendrik Boom
On Mon, Sep 14, 2020 at 01:11:34AM -0700, Tony Garnock-Jones wrote:
> On Sunday, September 13, 2020 at 12:41:15 AM UTC+2 hen...@topoi.pooq.com 
> wrote:
> 
> > True, but that would require rewriting list, and quasiquote, ans 
> > others like that to use the hashcons. 
> >
> > Not impossible. 
> >
> 
> One potentially useful trick is to write a function `canonicalize` which 
> deeply traverses the structure of its argument, rebuilding it if necessary 
> to produce the canonical representative for each piece of substructure. 
> Then you can `(canonicalize (map f xs))` without having to rewrite `map`, 
> and it takes (asymptotically) the same time as it would if you did alter 
> `map`.
> 
> Another thing to watch out for is that hashconsing via `equal?` can be 
> quite expensive for things like hash tables. I used hashconsing extensively 
> in the first implementation of Syndicate and ended up having to implement 
> my own treaps to get good asymptotic performance with a hashconsed 
> dictionary structure.

I would, ideally, only use hashcons on those cons-cells which had themselves 
been hashconsed, so eq? would suffice.

-- hendrik

-- 
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/20200914121810.vsbo56odmxf7r4f6%40topoi.pooq.com.


Re: [racket-users] Incorporating Markdown documents into Scribble

2020-09-13 Thread Hendrik Boom
On Sun, Sep 13, 2020 at 07:50:01AM -0400, Shriram Krishnamurthi wrote:
> It's useful to have this behave like a `#include`. There are settings where
> you want to have a non-Scribble person author things that go "in the
> middle"; you want to think of this as just a more convenient way of writing
> what you'd have written in Scribble.
> 
> I realize there's presumably a closure issue (`section` isn't going to come
> from the including file), and for that you probably want a different
> include form as well.

The main thing I need markdown for is to include nested small bullet points, 
in an explorative mind-mapping style.

The Scribble syntax is too wordy to be convenient.

Just as @paragraph{  } would be inconvenient to mark all the paragraphs in 
ordinary text.

-- hendrik

> 
> -- 
> 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/CAJUf2yRcPq3-Gvxy3F95PJhBmiebquEvU3Sz6-y%3D98LFb_Wnvw%40mail.gmail.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/20200913142451.56znr2ekrd65kaaf%40topoi.pooq.com.


Re: [racket-users] Re: hashcons

2020-09-12 Thread Hendrik Boom
On Sat, Sep 12, 2020 at 01:23:24PM -0700, jackh...@gmail.com wrote:
> Not automatically, but you can make your own wrapper function around cons 
> that interns them using a weak hash table and then you can use that wrapper 
> function everywhere.

True, but that would require rewriting list, and quasiquote, ans 
others like that to use the hashcons.

Not impossible.

-- hendrik

> 
> On Thursday, September 10, 2020 at 7:34:37 PM UTC-7 hen...@topoi.pooq.com 
> wrote:
> 
> > Is there a way to run Racket so that every immuable cons is made with 
> > a hashcons operation; i.e. it makes a new cons scel only if there 
> > isn't already one in memory somewhere with the same car and cdr 
> > values?
> >
> > -- hendrik
> >
> 
> -- 
> 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/7ed721c9-4ed2-47eb-b8bb-a30a1ed9125fn%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/20200912224106.dretb2jnz6rtf3yc%40topoi.pooq.com.


Re: [racket-users] Incorporating Markdown documents into Scribble

2020-09-12 Thread Hendrik Boom
On Sat, Sep 12, 2020 at 06:14:53AM -0700, Shriram Krishnamurthi wrote:
> I need a little help with `decode` vs `decode-flow` in Scribble. (Also, 
> this thread is about a question I wasn't able to find answered anywhere, so 
> hopefully it will lead to a solution that others can also use.)
> 
> Sometimes it's really useful to incorporate Markdown-formatted content into 
> the middle of a Scribble document. (Let's not argue about this, please!) My 
> assumption is that the Markdown document lives in a separate file (I'm not 
> trying to do any clever textual inlining). Thanks to Greg Hendershott, I'm 
> almost there! I use
> 
> https://github.com/greghendershott/markdown
> 
> Here are two versions of the inlining function:
> 
> @(require markdown markdown/scrib scribble/decode)
> 
> @(define (markdown-inline file)
>(decode-flow
>(xexprs->scribble-pres
>  (with-input-from-file file read-markdown
> 
> @(define (markdown-part file)
>(decode
>(xexprs->scribble-pres
>  (with-input-from-file file read-markdown
> 
> As a practical matter, `markdown-part` needs to take lots of extra 
> arguments to create the appropriate part instead of just producing a 
> title-less section. More importantly, you often don't want a separate 
> section: you just want to "splice" the content into the current context.
> 
> `markdown-inline` works great for this purpose, *except* if the included 
> Markdown file contains any sections of its own, e.g.,
> 
> This is text.
> 
> > Lorem ipsum
> 
> # Section
> 
> ## Subsection
> 
> Then I get this error:
> 
> decode-flow: contract violation
> 
>   expected: pre-flow?
> 
>   given: (part-start 0 #f '((part "section")) (style #f '()) '("Section"))
> Any recommendations on how to create a "splicing" version that also 
> respects having sub-sections, or is that impossible? (I've tried pulling 
> out parts of the `part`, etc., but without success.)
> 
> Thanks!
> 
> Shriram
> 
> -- 
> 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/3f0b1012-783d-464a-a0ed-66d3f29f8893n%40googlegroups.com.

This looks very useful.

-- hendrik

-- 
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/20200912163734.pdin66tp3zzmxa2f%40topoi.pooq.com.


Re: [racket-users] package manager woes on Windows 10?

2020-09-11 Thread Hendrik Boom
On Thu, Sep 10, 2020 at 10:27:39AM -0400, George Neuner wrote:
> 
> 
> On 9/10/2020 10:06 AM, Philip McGrath wrote:
> > Also, this is happening over encrypted HTTPS: no one is sniffing the
> > User-Agent header.
> 
> While it may not be the issue here, you need to understand that appliance
> firewalls CAN and routinely DO examine data inside encrypted connections.

Using man-in-the-middle attacks?

-- hendrik

-- 
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/2020093319.dvxfeugmhuyqkx7i%40topoi.pooq.com.


[racket-users] hashcons

2020-09-10 Thread Hendrik Boom
Is there a way to run Racket so that every immuable cons is made with 
a hashcons operation; i.e. it makes a new cons scel only if there 
isn't already one in memory somewhere with the same car and cdr 
values?

-- hendrik

-- 
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/20200911023429.7ux4r567yrqh7q2l%40topoi.pooq.com.


Re: [racket-users] package manager woes on Windows 10?

2020-09-10 Thread Hendrik Boom
On Thu, Sep 10, 2020 at 12:49:25AM -0400, George Neuner wrote:
> 
> I don't know if DrRacket even sends a "user agent" string.

If DrRacket can send a user agent string, so can malware.

So it's not really reliable to filter on the user agent string.

-- hendrik

-- 
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/20200910113752.ej65fc6clr245yan%40topoi.pooq.com.


Re: [racket-users] Create C functions for embedded Racket CS

2020-09-02 Thread Hendrik Boom
On Wed, Sep 02, 2020 at 02:05:11PM -0700, dotoscat wrote:
> There are a function such scheme_make_prim_w_arity 
> 
> for the CS version? 

> The idea is to use Racket
> as a scripting language for a C program.

That's what guile was designed for.
How does Racket measure up as a scripting language for C?

-- hendrik

-- 
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/20200902213805.44xhu4mncp7s4wyi%40topoi.pooq.com.


Re: [racket-users] abstraction suggestion?

2020-08-31 Thread Hendrik Boom
On Mon, Aug 31, 2020 at 10:06:42AM -0700, Shriram Krishnamurthi wrote:
> I'm having some trouble abstracting over this code. Any suggestions?
> 
> I have numerous files that follow this boilerplate:
> 
> #lang racket
> 
> (require )
> 
> (provide (rename-out [mod-begin #%module-begin]
>  [ti#%top-interaction]))
> 
> (define-values (namespaces lang-print-names)
>   )
> 
> (define-syntax (multi-runner stx)
>   (syntax-case stx (TEST)
> [(_ (TEST e r ...))
>  #`(test-output 'e (list 'r ...) namespaces)]
> [(_ e)
>  #`(show-output 'e namespaces lang-print-names)]))
> 
> (define-syntax mod-begin
>   (λ (stx)
> (syntax-case stx ()
>   [(_ b ...)
>#'(#%printing-module-begin (multi-runner b) ...)])))
> 
> (define-syntax ti
>   (λ (stx)
> (syntax-case stx ()
>   ([_ . e]
>#'(#%top-interaction . (multi-runner e))
> 
> I've abstract most of the details into `test-output` and `show-output` into 
> . I would ideally like to move as much of what's left as 
> possible into the same file. 
> 
> The key problem is that the MB and TI depend on `multi-runner`, which in 
> turn depends on `namespaces`, which is a name at run time. As long as 
> everything is in the same module, no problem. But when I start to move the 
> boilerplate out…
> 
> Concrete suggestions welcome — I've tried several different things (various 
> forms of abstraction, syntax parameters, etc.) without luck.

Maybe a macro or two?  Perhaps a nonhygienic one?

-- hendrik

> 
> Thanks,
> Shriram
> 
> -- 
> 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/362f807e-3561-4be6-8b4d-937776fea36bn%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/20200831172435.6f6oweyhxjux4g5j%40topoi.pooq.com.


Re: [racket-users] Proper place to store log file

2020-08-25 Thread Hendrik Boom
On Mon, Aug 24, 2020 at 11:02:35AM -0700, Thomas Del Vecchio wrote:
> Hi everyone!
> 
> I'm currently working on some usage logging for a language we're 
> developing. We need to store a persistent file that is shared across a 
> given device (so that the same log file is used regardless of where you are 
> working). Is there a best place to put this file? I'm looking at 
> find-system-path 
> ,
>  
> but am not sure from the documentation if one of these is best for this 
> purpose.

If the log file is to be system-wide, linux has the directory /var/log

-- hendrik
> 
> One option I'm considering is in `(collection-file-path (build-path 
> "logging" "user-logs.log") "")`, which is just 
> "///logging/user-logs.log", but I'm unsure whether 
> it's safe to store user data there (especially if we are expecting to have 
> package updates).
> 
> Thanks so much!
> Thomas
> 
> -- 
> 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/bd7203d0-db4c-4e56-a19f-fb4cb58c8625n%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/20200826015244.per77fshze7j6tjo%40topoi.pooq.com.


Re: [racket-users] Re: Application Templates!

2020-08-20 Thread Hendrik Boom
On Wed, Aug 19, 2020 at 09:33:01PM -0700, Alex Harsanyi wrote:
...
...
> I think Racket would benefit by a suite of applications which are small but 
> not trivial and with a source code which is commented in more detail than a 
> regular application.

Every regular application would also benefit from being commented in 
this much detail.

-- hendrik

-- 
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/20200820131137.z3mazyfs6l23ozdf%40topoi.pooq.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 ema

[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] slideshow -> google slides?

2020-08-07 Thread Hendrik Boom
On Thu, Aug 06, 2020 at 06:58:28PM -0400, 'John Clements' via Racket Users 
wrote:
> Has anyone here developed a reasonable workflow for exporting slideshow 
> presentations to google slides? It appears that google slides cannot import 
> PDFs or SVGs. It looks like it has support for importing PPT files, 
> unsurprisingly, but AFAIK slideshow won’t export ppt files. I have no idea 
> how nasty the PPT format is.
> 
> Right now I’m looking into PDFelement, a mac program, but I’d love to hear 
> about other options. 

As well as the Open- and Libre-Office I mentioned before, you might try Krita.  
It's 
a artist-grade draw and paint program, and it has a surprising number of tools. 
 
I've heard that it can do vector graphics, but I've never actually tried that, 
so I 
just don't know.

Let us know what turns out to work.  I'm curious.  I've had pdf files that work 
in 
some but not other pdf viewers and even crash my printer, and anything that can 
clean them up would be walcome.  Sometimes just viewing and saving in one is 
enough 
to make it work in others.

-- hendrik

> 
> Thanks!
> 
> John
> 
> -- 
> 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/7a2b8538-91f9-45e2-9006-5e8047d39973%40mtasv.net.

-- 
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/20200807171246.634xi27lsixjojbe%40topoi.pooq.com.


Re: [racket-users] slideshow -> google slides?

2020-08-07 Thread Hendrik Boom
On Fri, Aug 07, 2020 at 09:58:15AM -0400, David Storrs wrote:
> On Thu, Aug 6, 2020, 10:34 PM Hendrik Boom  wrote:
> 
> > On Thu, Aug 06, 2020 at 06:58:28PM -0400, 'John Clements' via Racket Users
> > wrote:
> > > Has anyone here developed a reasonable workflow for exporting slideshow
> > presentations to google slides? It appears that google slides cannot import
> > PDFs or SVGs. It looks like it has support for importing PPT files,
> > unsurprisingly, but AFAIK slideshow won’t export ppt files. I have no idea
> > how nasty the PPT format is.
> > >
> > > Right now I’m looking into PDFelement, a mac program, but I’d love to
> > hear about other options.
> >
> > Have you tried libreoffice or openoffice?  (They're not the same, so one
> > might work
> > if the other doesn't.)  My wife used to make presentations from one of
> > them a few
> > years ago, and as far as I know, they were powerpoint compatible.
> > Unfortunately
> > she's not around to ask any more.
> >
> > -- hendrik
> >
> 
> I'm very sorry for your loss, Hendrik. My father died in 2019 and it's been
> agonizing, but I didn't live with him on a daily basis. I don't know how
> long it's been for you but I hope you're all right.

It's been just over a year.

I left her laptop on, just in case.

And yes it has stayed on for over a year.

It's a Mac.  And I can't figure out how to use it -- still logged in as her, 
but if 
I try to read the Mac beginners' quide all it does is ask for a password.  I 
can 
get to the Unix shell and use that, but I still have to keep dismissing the 
password 
request.

-- hendrik

-- 
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/20200807164557.rwyqr4lyvsrflnft%40topoi.pooq.com.


Re: [racket-users] slideshow -> google slides?

2020-08-06 Thread Hendrik Boom
On Thu, Aug 06, 2020 at 06:58:28PM -0400, 'John Clements' via Racket Users 
wrote:
> Has anyone here developed a reasonable workflow for exporting slideshow 
> presentations to google slides? It appears that google slides cannot import 
> PDFs or SVGs. It looks like it has support for importing PPT files, 
> unsurprisingly, but AFAIK slideshow won’t export ppt files. I have no idea 
> how nasty the PPT format is.
> 
> Right now I’m looking into PDFelement, a mac program, but I’d love to hear 
> about other options. 

Have you tried libreoffice or openoffice?  (They're not the same, so one might 
work 
if the other doesn't.)  My wife used to make presentations from one of them a 
few 
years ago, and as far as I know, they were powerpoint compatible.  
Unfortunately 
she's not around to ask any more.

-- hendrik

> 
> Thanks!
> 
> John
> 
> -- 
> 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/7a2b8538-91f9-45e2-9006-5e8047d39973%40mtasv.net.

-- 
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/20200807023356.ljyhfbzlvdtfbhxl%40topoi.pooq.com.


Re: [racket-users] Advice wanted about new opengl binding

2020-08-03 Thread Hendrik Boom
On Mon, Aug 03, 2020 at 02:01:16PM -0400, Philip McGrath wrote:
> Is this what you're looking for? https://pkgs.racket-lang.org/package/sgl
> 
> -Philip

Yes, looks like it.  Is it messing from the index for some good reason?

I'm not sure how the packaging works.

I end up at https://github.com/racket/sgl/tree/master
where I find multiple files, including main.rkt, sgl.rlt, and gl.rkt.
Am I correct that main.rkt is what I get with (require sgl)
and that gl.rkt is what I get with (require sgl/gl)?

-- hendrik

> 
> 
> On Sun, Aug 2, 2020 at 5:51 PM Hendrik Boom  wrote:
> 
> > Time to rethink everything before I go further.
> >
> > So far I've found several opengl bindings.
> > There's opengl, documented here:
> >https://docs.racket-lang.org/opengl/index.html
> > There are sgl and sgl/gl, documented here:
> >https://docs.racket-lang.org/sgl/index.html
> > and there's a typed opengl hidden with in pict3.
> >
> > But I cannot find sgl and sgl/gl in the index of packages
> > at https://pkgs.racket-lang.org/
> >
> > Shouldn't they be there?
> > Are they there in disguise?
> > Abd where should I look for current source code?
> > The index is pretty good at identifying source code for other packages.
> >
> > -- hendrik
> >
> > --
> > 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/20200802215123.iiqik4wpfusarcw4%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 racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAH3z3gYmn4_5sTUNWuZDcpjL5shJmU2quTtgx72%3DoycOXccp5A%40mail.gmail.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/20200803232728.e4yv7khscvr7c2wl%40topoi.pooq.com.


Re: [racket-users] ask the type of a value (partial solution)

2020-08-03 Thread Hendrik Boom
On Mon, Aug 03, 2020 at 05:06:51PM +0100, Laurent wrote:
> and yet:
> 
> > (for-each
>(λ (x) (printf "~a: ~a\n" (~v x #:min-width 28) (struct->vector x)))
>`(hello "hello" 43110 #f #(h e l l o) #"hello" (h e l l o)
>,(new frame% [label ""])))
> 
> hello   : #(struct:symbol ...)
> "hello" : #(struct:string ...)
> 43110   : #(struct:fixnum-integer ...)
> #f  : #(struct:false ...)
> #(h e l l o): #(struct:vector ...)
> #"hello": #(struct:byte-string ...)
> (h e l l o) : #(struct:pair ...)
> #(struct:object:frame% ...) : #(struct:object:frame% ...)
> 
> ;)

Thank you.

That itself is already useful.
struct->vector combined with printf handles my immediate application.
It told me #(struct:object:image-snip% ...)
As I've been warned, it doesn't tell me much, but the result is a 
useful clue for further investigation.

It turns out to react positively to image?

Still, it would be nice to find out how to get this information more 
directly instead of relying on functions that do much more than 
what I was asking for.

-- hendrik

> 
> 
> On Mon, Aug 3, 2020 at 4:20 PM Alexis King  wrote:
> 
> > In general, the answer is “no,” mostly because it’s not clear in Racket
> > what “the type of a value” means. It’s difficult to come up with a
> > definition that would be useful enough to satisfy your criterion of not
> > “having to guess it first.” Consider: suppose you had a hypothetical
> > `type-of` operation that returned a value’s type:
> >
> > (type-of 'hello) ; => 'symbol
> > (type-of "hello") ; => 'string
> >
> > Now suppose you apply type-of to a value you know nothing about and get
> > back 'widget. Well, you don’t know what a widget is, so that didn’t
> > actually get you any further from where you started: you still don’t know
> > what to do with the value.
> >
> > Furthermore, types are not actually disjoint. You can write a struct
> > definition with properties like prop:procedure and prop:evt, and if a
> > struct has both, should type-of return the struct’s name, 'procedure, or
> > 'evt? It’s not really clear. You might be able to come up with some more
> > sophisticated system with (potentially multiple) inheritance that could
> > capture these relationships, but I can say with confidence that no such
> > system currently exists in Racket.
> >
> > Alexis
> >
> > > On Aug 3, 2020, at 09:19, Hendrik Boom  wrote:
> > >
> > > In plain, untyped Racket:
> > >
> > > It is possible to ask if a value is a symbol with symbol?
> > > It is possible to ask if a value is a string with string?
> > > etc.
> > >
> > > Is there a way to ask the type of a value without having to guess it
> > first?
> > >
> > > -- hendrik
> >
> > --
> > 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/C561F2A9-0C78-4EDA-A401-4FB067D79849%40gmail.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/20200803164843.if7wggbketi2ziyl%40topoi.pooq.com.


[racket-users] ask the type of a value

2020-08-03 Thread Hendrik Boom
In plain, untyped Racket:

It is possible to ask if a value is a symbol with symbol?
It is possible to ask if a value is a string with string?
etc.

Is there a way to ask the type of a value without having to guess it first?

-- hendrik

-- 
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/20200803141931.t4v4nc2e5d4afx6f%40topoi.pooq.com.


Re: [racket-users] pictures in code?

2020-08-03 Thread Hendrik Boom
On Sun, Aug 02, 2020 at 08:58:54PM -0700, Sorawee Porncharoenwase wrote:
> For DrRacket, it's possible via "Insert > Insert Image". It's been used in
> HtDP. See https://htdp.org/2020-8-1/Book/part_prologue.html

Yes!  That's where I saw this many years ago.

Now that's presumably something that works nicely in the DrRacket editor.
When DrRacket saves it into a file, it presumably uses some notation that
won't look like a picture in, say, emacs.
But will it still be recognised as an image if I use Racket to run that file?
Can the image be used as a symbol or a constant or is it some other type 
of object?

-- hendrik

> 
> On Sun, Aug 2, 2020 at 7:07 PM Hendrik Boom  wrote:
> 
> > Is there any way to include pictures in Racket code?
> > Perhaps as constants or as prts of identifiers?
> > The idea is that when editing the program in the Racket editor,
> > the pictures are visible as part of the code,
> > making the code itself more visually self-evident,
> > not as file names to be read from elsewhere.
> >
> > -- hendrik
> >
> > --
> > 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/20200803020710.d2rvz6gojluubt5t%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 racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CADcuegvJCAHQYwO-eCcqKfqwhrd%2BGr4PELie_e0%3DO9b2PJ_QAA%40mail.gmail.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/20200803134732.w5lq45vkglq2pmu6%40topoi.pooq.com.


[racket-users] pictures in code?

2020-08-02 Thread Hendrik Boom
Is there any way to include pictures in Racket code?
Perhaps as constants or as prts of identifiers?
The idea is that when editing the program in the Racket editor,
the pictures are visible as part of the code,
making the code itself more visually self-evident,
not as file names to be read from elsewhere.

-- hendrik

-- 
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/20200803020710.d2rvz6gojluubt5t%40topoi.pooq.com.


Re: [racket-users] Advice wanted about new opengl binding

2020-08-02 Thread Hendrik Boom
Time to rethink everything before I go further.

So far I've found several opengl bindings.
There's opengl, documented here:
   https://docs.racket-lang.org/opengl/index.html
There are sgl and sgl/gl, documented here:
   https://docs.racket-lang.org/sgl/index.html
and there's a typed opengl hidden with in pict3.

But I cannot find sgl and sgl/gl in the index of packages
at https://pkgs.racket-lang.org/

Shouldn't they be there?
Are they there in disguise?
Abd where should I look for current source code?
The index is pretty good at identifying source code for other packages.

-- hendrik

-- 
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/20200802215123.iiqik4wpfusarcw4%40topoi.pooq.com.


Re: [racket-users] Advice wanted about new opengl binding

2020-08-01 Thread Hendrik Boom
On Sat, Aug 01, 2020 at 11:48:06AM -0600, Matthew Flatt wrote:
> At Fri, 31 Jul 2020 17:05:27 -0400, Hendrik Boom wrote:
> > For example, there's glGetCompressedTexImageARB.  It receivees a 
> > pointer to an image area and fills it in with a compressed image.
> > According the the Racket C interface, the way to write this 
> > would be:
> > 
> > (define-gl glGetCompressedTexImageARB 2 
> >   ( (target : _int32)
> > (level : _int32) 
> > (img : _pointer/intptr)
> >   -> _void -> img)
> >  (->> exact-integer? exact-integer? gl-pointer?)
> >  check-gl-error)
> 
> If I understand correctly that `target` and `level` provide enough
> information to specify how big `img` should be, then I agree that
> something analogous to
> 
>(_fun
>  (target : _int32)
>  (level : _int32) 
>  (img : _pointer/intptr = (malloc (COMPSIZE target level)))
> -> _void
> -> img)
> 
> is a fine way to wrap the function.
> 
> But when I work at the level of C APIs, I usually prefer this kind of
> interface:
> 
> > But the old binding instead used
> >  ( (target : _int32)
> >(level : _int32)
> >(img : _pointer/intptr)
> >   -> _void)
> > 
> > In other words, it ignored the fact that img is used as an output 
> > parameter.
> 
> Although, when I use this kind of binding, I have to know which
> pointers must already be filled with information when I pass it to the
> function versus which ones will be filled by the function, exposing the
> pointer to to-be-filled memory gives me control over the way that the
> memory. It also avoids having to specify anything about the
> deallocation rules of the result of a binding (e.g., whether it needs
> to be explicitly freed).

This makes it all feel like what the C documentation says about the function.
and you have to use it like C.  And it helps a lot if you can know 
whether the C code retains pointers to the storage area you passed it.
(Which I believe OpenGL does not, being organised entirely for passing 
data to a different processor.  But there could be problems if it the 
data transfer were implemented using DMA asynchronously)

> 
> Still, I can also see the advantage of building allocation into the
> wrapper to make clear that the argument corresponds to to-be-filled
> memory.

Yes.  It's clear.  But if usage is to allocate partucular storage areas 
and use them repeatedly for getting data back from OpenGL, then this 
iplementation is preferred.

> 
> Perhaps it depends on the overall shape of the API. If the API is going
> to be wrapped further to make it more Rackety, then I'd go for less
> wrapping at the immediate FFI bindings. If the API looks fairly Rackety
> with a few tweaks to arguments and results, then I'd favor more
> wrapping in the bindings. I think the old GL binding was in the former
> camp: it first exposed GL functions in as raw as possible form, and
> then wrapped those with a higher-level library.

So for compatibility I should preserve the C-style calls.
Now it gets difficult.  Some functions in the old bindings use what 
seems to be the C-style conventions, and others the Racket-level 
conventions with the two '->' arrows.

I have yet to figure out the conventions it uses.

I do know that the old specfiles from which the Racket binding was 
machine-generated had an explicit keyword identifying output parameters.

The new ones in xml do not.

I'm going to have to investigate firther.

And track down the source code for both the C and Racket versions and 
how they are generated.  So far I've seen one.

And perhaps also the typed OpenGL function withing Pict3D.

This update isn't going to be done for quite a while unless I get some 
inspiration.

It is going to take more thought.  I don't want to create the situation 
like with xml where there are two subtly incompatible implementations 
being used, making it hard to use soem applications together.

(I'm using sxml to read the API definition.  How that's the right 
choice).
> 
> > Now what should I do with this?  As I said there are very many such 
> > functions.  It's not an isolated case.
> > 
> > Are all these glGet functions simply something that never happened to 
> > get used in Racket code so no one noticed the discrepancy?
> > Is there some idiom in Racket programming where all this just works 
> > anyway?
> > Is there some efficency reason for not recognising output parameters?
> > Do they parhaps cause new storage allocation every time they are called?
> 
> I wouldn't say there's any "discrepancy" in `img` being an output
> argument instead of an input argument. This kind of input--output
> distinction doesn't exist at C ABI level, so no d

[racket-users] Advice wanted about new opengl binding

2020-07-31 Thread Hendrik Boom
I need advice from someone with more experience with openGL and/or 
Racket.

I am still working on updating the Racket openGL binding to the current 
openGL spec.

I'm doing this as in the old binding, machine-translating the formal 
part of the openGl standard, which now uses a competely new formalism.

I'm debugging it (for now) by comparing the old Racket include file with 
the new one on the theory that functions that were there a few years ago and 
are still there should have teh same Racket definitions now as then.

Running into a big snag.

There are a *lot* of glGet functions that grab data from the video 
processor and bring it to the CPU.
They give openGL a pointer to a storage area where it should return 
data.

For example, there's glGetCompressedTexImageARB.  It receivees a 
pointer to an image area and fills it in with a compressed image.
According the the Racket C interface, the way to write this 
would be:

(define-gl glGetCompressedTexImageARB 2 
  ( (target : _int32)
(level : _int32) 
(img : _pointer/intptr)
  -> _void -> img)
 (->> exact-integer? exact-integer? gl-pointer?)
 check-gl-error)

(here define-gl is a macro interal to the opengl binding that contains a 
number of input arguments and a contract for the manual as well as the 
actual c interface description, which of course is

  ( (target : _int32)
(level : _int32)
(img : _pointer/intptr) 
  -> _void -> img)

Here the '-> _void' specifies the value returned as function value from 
C, and ->img indicates what the Racket openGL bindig s to return as to 
the Racket calling program.

But the old binding instead used
 ( (target : _int32)
   (level : _int32)
   (img : _pointer/intptr)
  -> _void)

In other words, it ignored the fact that img is used as an output 
parameter.

Now what should I do with this?  As I said there are very many such 
functions.  It's not an isolated case.

Are all these glGet functions simply something that never happened to 
get used in Racket code so no one noticed the discrepancy?
Is there some idiom in Racket programming where all this just works 
anyway?
Is there some efficency reason for not recognising output parameters?
Do they parhaps cause new storage allocation every time they are called?

I would prefer that other Racket code that uses the old binding not have 
to be rewritten for the new.  I'd like the new binding to be both 
correct and compatible insofar as compatibility matters.

And I would very much prefer my binding to follow spec on both the 
openGL front and the Racket front.

Or maybe I should call the new binding something else, like opengl3, 
so that old code can use old bindings and new code the new.
That would be touble for those using old libraries who also want to use 
ew features.

And I've encountered a few cases where I think the old binding is just 
wrong.

I would appreciate advice on these matters from those with more Racket 
or more openGL experience.

-- hendrik

-- 
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/20200731210527.lrbk4sajudjuivck%40topoi.pooq.com.


Re: [racket-users] Does Racket interpreter exist?

2020-07-29 Thread Hendrik Boom
On Wed, Jul 29, 2020 at 01:56:05AM -0700, zeRusski wrote:
> This is a really cool piece of history! Thank you.
> 
> I'll admit I'm somewhat fuzzy here - it maybe a bit too meta for me or 
> perhaps I don't quite understand what you're trying to say. Isn't 
> interpreting n levels deep also linear in n?

Answer 1.

Let's say, for example, that it takes 10 instructions executed in an 
interpreter to decode, take decisions, and execute an interpreted 
instruction.  (In real life this varies a lot between interpreters and 
between interpreted instructions but let's keep the example simple.)
(and, also to keep things simple, let's say the interpreter in 
interpreting the machine language of the machne it's running on -- 
not an unusual technique in a debugger.)

Then interpreting a program using an interpreter running on hardware 
would take ten times as long as executing the program on the same 
hardware.

And likewise, interpreting the program in an interpreter being 
interpreted by the interpeter running on the hardware would take another 
ten times as lng as just interpreting the program with an interpreter 
running on the hardware.  

Thus 10 x 10, times as slow; this is where the exponential comes in.

> Only difference between the 
> two approaches  I see is that compiler lets you persist the fruits of its 
> labor so you don't have to start from scratch every time. Couldn't you 
> accommodate this with an interpreter (with some effort) although at this 
> point it becomes a compiler I suppose. Definitely fuzzy here.

That is exactly the difference between a compiler and an interpreter.

Answer 2:

Time to muddy the situation.

There are mixed-style language implementations.

If you only execute each piece of code once, interpreters tend to be 
faster.  But if you are to execute code many times, it's faster to 
compile.  It takes time to compile, but you get it back by saving time 
in later executions.

So what thee mixed implementations to is to interpret the code, but 
keeping track how often each piece of code (such as a function) is 
called.

When the count reaches a particular threshold, it pauses interpretation 
and compiles that code, the compiled code to be used thereafter.

There is some time penalty over compilation, because you waste time 
interpreting functions several times before you compile them.
This is offset by not having to compile code that is used only a few 
times.

The time behaviour of this kind of system overall is more like a 
compiler than an interpreter because the code that is executed the most 
does eventually get compiled and the rest gets interpeted only a limited 
number of 
times.

However, if it were to execute a copy of its own code, it would have to 
recompile it, unless it had a mechanism to check if the newly input 
program is the same as one it has already compiled.  This isn't 
impossible, but is not usually done.

> 
> > But when going n levels deep, the total execution time with a compiler 
> > is linear in n, and with an interpreter it's exponential. 

I use this criterion to tell whether a particular implementation is more 
like an interpreter or a compiler.

> >
> > That makes interpreting interpreters impractical when n gets large (even 
> > with n around 3 or 4); whereas compiling compilers can be done even for 
> > larger n. 
> >

Answer 3.

On modern machines, it is also important to keep memory demands low.  
Accessing large amounts of memory regularly tends to push other data our 
of cache, or even out of RAM onto disk.

Conserving storage is a common reason for using interpreted bytecode as 
the target language for a compiler.  The bytecode is usually smaller 
than the machine language.  If the bytecode interpreter is small enough, 
this is a definite win.  Bytecode was first used, as far as I know, on 
machines with small memories -- about 64K RAM total or even less.

Byte-code can also be portable.  You just need to write a (usually 
amall) bytecode interpreter for each new machine.

Of course it's still possible to, at run-time, compile the most-used 
byte-coded functions in to actual machine code to trade memory use for 
execution time.

Answer 4:  An example:

The language FORTH used a *word*-code interpreter instead of a 
byte-code interpreter, each word being two bytes, and containing the 
address of the interpreter's machine-code routine that implemented that 
instruction.

This meant each word representing an instruction could be 
executed in the interpreter by a hardware function call to an 
indirect address.  In fact, user-coded functions could be called the 
same way -- each would be a sequence of addresses preceded by the 
machine code that invokes the word-code interpreter. 

Still very compact on a machine with two-byte addresses.

Utterly impractical on a modern machine with 64-bit addresses, where the 
machine code for an operation can often be smaller than a machine 
address.

-- hendrik 

I hope this set of answers clarifies the 

Re: [racket-users] Does Racket interpreter exist?

2020-07-28 Thread Hendrik Boom
On Mon, Jul 27, 2020 at 11:07:43AM -0700, zeRusski wrote:
> 
> >
> > The best way to distinguish compilers from interpreters is that a 
> > compiler takes a program and produces another program, whereas an 
> > interpreter takes a program (along with some input) and produces an 
> > answer. 
> >
> 
> Doesn't this trivialize the difference a bit too much? Does it really come 
> down to the time you choose to compute? I persist intermediate state - I am 
> a compiler. I do the exact same thing (run off the same "compiler" 
> codebase) but ask for inputs and compute - I am an interpreter.
> 
> I scratched my head a bit and came up with the following: if there is one 
> to one correspondence between target and host language "blocks" (there may 
> be multiple such pairs till you get to machine code) then this is an 
> interpreter. If you do nasty shenanigans in the generated code in the host 
> (semantics altering optimisation passes and what not) then this is a 
> compiler. Latter ought to effect debugging even error reporting quite 
> drastically. This is almost certainly naive and amateur of me. I'm 
> desperately trying to understand why I have the impression that there ought 
> to be a non-trivial difference between the two. That's been my impression 
> from the literature.


There is an important distinction here, and it has to do with resource 
consumption when iterated.

This is most easily explained in the case(s) of a compiler and 
interpreter that are written in the languages they implement.

Clearly you can compile such a compiler using itself, and similarly, 
interpret such an interpreter, and you can do that n levels deep should 
you want to.

But when going n levels deep, the total execution time with a compiler 
is linear in n, and with an interpreter it's exponential.

That makes interpreting interpreters impractical when n gets large (even 
with n around 3 or 4); whereas compiling compilers can be done even for 
larger n.

This is important when the nesting implemntations are not identical.  
This might involve interpreting different languages one in the other.
But it might, very practically, involve compiling different versions of 
the same language in a proess of incremental development.  The Algol 68 
C compiler, for example, went through hundreds of versions, each 
compiling the next one, an each providing better tools for the 
implementer to use.  That would have been practically impossible with a 
self-interpreter.

By the way, one of their tests was to use the compiled compiler to 
compile itself two levels deep and see if the two self-compiled object 
codes were identical.  If not, there was a problem.

Many systems are a mix of compiling and interpreting, such as many 
Scheme implementations.

And ultimately, the actual machine hardware usually interprets machine 
code.

Yes, there are ambiguous corner cases.  Such as some of the Apple macs 
that run previous hardware generations by compiling basic blocks of 
old machine code one by one at run time. Or JIT compilation.  Or running 
Verilog code on a programmable gate array.

Some of these are situations where the self-implementation model just 
doesn't really apply.  Silicon is silicon, and is hardware, and isn't 
interpreted.  It just does what silicon does.

-- hendrik

> 
> I think I had this paper in mind: https://www.jilp.org/vol5/v5paper12.pdf 
> oh wait p4: "we do not have a precise definition for efficient interpreter" 
> ... oh good. Although they do mention some justification for "compiling" to 
> a VM in the following paragraphs that boils down to "avoid the overhead of 
> re-parsing and re-interpreting intermediate representation". I vaguely 
> recall that Lisp in Small Pieces switched to a VM when the "fast 
> interpretation" was introduced.
> 
> I may have confused myself. Badly :(
> 
> I guess I would call Tcl and Picolisp interpreters and Racket and most 
> Scheme implementations of note not at all.
> 
> -- 
> 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/98a4e936-1703-4182-bb85-ce78a8694feao%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/20200728111748.gl7bs2ttcdy7i4oq%40topoi.pooq.com.


[racket-users] reading s-expressions from a file

2020-07-17 Thread Hendrik Boom
Yes,  I know the functino for reading s-expressions seems to be (read [in]).

I want a loop that reads S-expressions and does something to each one, until 
there are no more to be found in a file.

Now of course that's absurdly easy to do with a tail-recursice loop.

But I's like it to look like a loop, with (for ...) or (while ...) or 
(loop ...) or something like that.

But I fail to fine any iterators that process a file, such as (in-file 
...)

There's a long list of iterators in 
   https://docs.racket-lang.org/reference/for.html
and in 
   https://docs.racket-lang.org/guide/for.html

An I just looking in the wrong place, or are there really no iterators 
for reading a stream of s-expressions from a file.

-- hendrik

-- 
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/20200718001905.elzyuu42gje45j7t%40topoi.pooq.com.


[racket-users] Screen readers

2020-07-07 Thread Hendrik Boom
On Tue, Jul 07, 2020 at 11:44:53AM +0200, Jens Axel Søgaard wrote:

> The upside is that using standard elements work with custom themes used
> in the OS. Screen readers for blind also work with standard elements.

Just wondering.  What is available in the way of screen readers on a 
Linux system? 
I have a friend who complains there aren't any decent ones.

-- hendrik

-- 
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/20200707120918.wmkqjaoivenub5mm%40topoi.pooq.com.


[racket-users] bracket meme

2020-07-06 Thread Hendrik Boom
Found this signature quote:

--
Put not your faith in parenthesis, nor trust in dotted pears, says speech 
therapist.

used by DannyB on Soyent News

Thought it might be amusing here.

-- hendrik

-- 
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/20200706234107.olppyedipbc6b4ii%40topoi.pooq.com.


Re: [racket-users] Re: note about parsing speed of xml vs sxml?

2020-06-29 Thread Hendrik Boom
On Sun, Jun 28, 2020 at 06:01:27PM -0700, Alex Harsanyi wrote:
> I tested the your string port version and I also wrote a "string-append" 
> version of the xml reader and they are both slower by about 10-15% on my 
> machine, when compared to the current read-xml implementation which uses 
> `list->string`.  It looks like `list->string` is not the bottleneck here.

Odd -- to remove all that storage-allocaation overhead and to find it 
gets slower...

Perhaps the overhead lies in the Scheme interpreter?  Does it allocate 
lots of storage?
Would using chez racket help any?

-- hendrik
> 
> There are some small improvements that can be made from micro 
> optimizations.  For example, I changed `name-char?` to not use 
> `name-start?` but instead check for all chars, and I also changed 
> `lex-name` to construct the list in reverse and use `(list->string (reverse 
> chars))`, plus I reordered the cond condition to check the common case 
> first (that the next character is a name-char? and not a 'special one).  
> However, this resulted in only about 5-10% speed improvement, nowhere near 
> where the 4 time speedup when using `sxml`, as reported by John.
> 
> In the end, it may well be that speeding up `read-xml` can only be done by 
> these types of micro-optimizations.  Another thing I looked into was the 
> "pattern" used for reading: all the `read-xml` code will use the pattern of 
> "peeking" the next character, deciding if it is good, than reading it.  
> This is much slower than just reading the characters directly.  These are 
> the results from just reading in a 14Mb XML file:
> 
> read-char only:  cpu time: 312 real time: 307 gc time: 0
> read-char-or-special only:  cpu time: 750 real time: 741 gc time: 0
> peek-char than read-char:  cpu time: 1234 real time: 1210 gc time: 0
> peek-char-or-special than read-char-or-special:  cpu time: 1688 real 
> time: 1690 gc time: 0
> 
> Using this code:
> 
> (define file-name "your-test-file-here.xml")
> 
> (printf "read-char only~%")
> (collect-garbage 'major)
> (time
>  (call-with-input-file file-name
>(lambda (in)
>  (let loop ([c (read-char in)])
>(if (eof-object? c)
>(void)
>(loop (read-char in)))
> 
> (printf "read-char-or-special only~%")
> (collect-garbage 'major)
> (time
>  (call-with-input-file file-name
>(lambda (in)
>  (let loop ([c (read-char-or-special in)])
>(if (eof-object? c)
>(void)
>(loop (read-char-or-special in)))
> 
> (printf "peek-char than read-char~%")
> (collect-garbage 'major)
> (time
>  (call-with-input-file file-name
>   (lambda (in)
> (let loop ([c (peek-char in)])
>   (if (eof-object? c)
>   (void)
>   (begin
> (void (read-char in))
> (loop (peek-char in
> 
> (printf "peek-char-or-special than read-char-or-special~%")
> (collect-garbage 'major)
> (time
>  (call-with-input-file file-name
>   (lambda (in)
> (let loop ([c (peek-char-or-special in)])
>   (if (eof-object? c)
>   (void)
>   (begin
> (void (read-char-or-special in))
> (loop (peek-char-or-special in
> 
> Alex.
> 
> On Monday, June 29, 2020 at 5:30:43 AM UTC+8 rmculp...@gmail.com wrote:
> 
> > Thanks Alex for pointing out the use of list->string. I've created a PR (
> > https://github.com/racket/racket/pull/3275) that changes that code to use 
> > string ports instead (similar to Hendrik's suggestion, but the string port 
> > handles resizing automatically). Could someone (John?) with some large XML 
> > files lying around try the changes and see if they help?
> >
> > Ryan
> >
> >
> > On Sun, Jun 28, 2020 at 9:56 PM Neil Van Dyke  
> > wrote:
> >
> >> If anyone wants to optimize `read-xml` for particular classes of use, 
> >> without changing the interface, it might be very helpful to run your 
> >> representative tests using the statistical profiler.
> >>
> >> The profiler text report takes a little while of tracing through 
> >> manually to get a feel for how to read and use it, but it can be 
> >> tremendously useful, and is worth learning to do if you need performance.
> >>
> >> After a first pass with that, you might also want to look at how costly 
> >> allocations/GC are, and maybe do some controlled experiments around 
> >> that.  For example, force a few GC cycles, run your workload under 
> >> profiler, check GC time during, and forced time after.  If you're 
> >> dealing with very large graphs coming out of the parser, I don't know 
> >> whether those are enough to matter with the current GC mechanism, but 
> >> maybe also check GC time while you're holding onto large graphs, when 
> >> you release them, and after they've been collected.  At some point, GC 
> >> gets hard for at least me to reason about, but some things make sense, 
> >> and other things you decide when to stop digging. :)  If you record all 
> >> your measurements, you can compare 

Re: [racket-users] Re: note about parsing speed of xml vs sxml?

2020-06-28 Thread Hendrik Boom
On Sun, Jun 28, 2020 at 11:30:27PM +0200, Ryan Culpepper wrote:
> Thanks Alex for pointing out the use of list->string. I've created a PR (
> https://github.com/racket/racket/pull/3275) that changes that code to use
> string ports instead (similar to Hendrik's suggestion, but the string port
> handles resizing automatically). Could someone (John?) with some large XML
> files lying around try the changes and see if they help?

I'm currently using sxml to read the current openGL specification. 
2564178 bytes in one file. 
(a) Is that relevant to your request?
(b) What do I do to have a choice of which sxml to use?
(c) Do I need to figure out using xml as well?
(d) And what do you want the test to do?

-- hendrik

> 
> Ryan
> 
> 
> On Sun, Jun 28, 2020 at 9:56 PM Neil Van Dyke  wrote:
> 
> > If anyone wants to optimize `read-xml` for particular classes of use,
> > without changing the interface, it might be very helpful to run your
> > representative tests using the statistical profiler.
> >
> > The profiler text report takes a little while of tracing through
> > manually to get a feel for how to read and use it, but it can be
> > tremendously useful, and is worth learning to do if you need performance.
> >
> > After a first pass with that, you might also want to look at how costly
> > allocations/GC are, and maybe do some controlled experiments around
> > that.  For example, force a few GC cycles, run your workload under
> > profiler, check GC time during, and forced time after.  If you're
> > dealing with very large graphs coming out of the parser, I don't know
> > whether those are enough to matter with the current GC mechanism, but
> > maybe also check GC time while you're holding onto large graphs, when
> > you release them, and after they've been collected.  At some point, GC
> > gets hard for at least me to reason about, but some things make sense,
> > and other things you decide when to stop digging. :)  If you record all
> > your measurements, you can compare empirically the how different changes
> > to the code affect things, hopefully in representative situations.
> >
> > I went through a lot of these exercises to optimize a large system, and
> > sped up dynamic Web page loads dramatically in the usual case (to the
> > point we were then mainly limited by PostgreSQL query cost, not much by
> > the application code in Scheme, nor our request network I/O),
> > and also greatly reduced the pain of intermittent request latency spikes
> > due to GC.
> >
> > One of the hotspots, I did half a dozen very different implementations,
> > including C extension, and found an old-school pure Scheme
> > implementation was fastest.  I compared the performance of the
> > implementation using something like `shootout`, but there might be
> > better ways now in Racket. https://www.neilvandyke.org/racket/shootout/
> > I also found we could be much faster if we made a change to what the
> > algorithm guarantees, since it was more of a consistency check that
> > turned out to be very expensive and very redundant, due to all the ways
> > that utility code ended up being used.
> >
> > In addition to contrived experiments, I also rigged up a runtime option
> > so that the server would save data from the statistical profiler for
> > each request a Web server handled in production.  Which was tremendously
> > useful, since it gave us real-world examples that were also difficult to
> > synthesize (e.g., complex dynamic queries), and we could go from Web
> > logs and user feedback, to exactly what happened.
> >
> > (In that system I optimized, we used Oleg's SXML tools very heavily
> > throughout the system, plus some bespoke SXML tools for HTML and XML.
> > There was one case in which someone had accidentally used the `xml`
> > module, not knowing it was incompatible with the rest of the system,
> > which caused some strange failures (no static checking) before it was
> > discovered, and we changed that code to use SXML.)
> >
> > --
> > 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/68624c9a-df35-14a3-a912-df806799a7e0%40neilvandyke.org
> > .
> >
> 
> -- 
> 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/CANy33q%3DpZw9EPmZG%2Bdz5cRYMSP17Ofntq9JwFqVVoN8ZhO6POg%40mail.gmail.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] Re: note about parsing speed of xml vs sxml?

2020-06-28 Thread Hendrik Boom
On Sat, Jun 27, 2020 at 05:16:34PM -0700, Alex Harsanyi wrote:
> Looking at the source for `read-xml`, it seems to be using `list->string` 
> in several places.  That is, it reads characters one-by-one and constructs 
> a list by appending a character to the end of it, than calls `list->string` 
> to produce the string.  I suspect read-xml could be made faster by using 
> `string-append` in these cases.

So you would be copying and reallocating strings instead of cons-cells?

The way to make that eliminate all that allocation is to implement a 
likely big enough mutable string buffer and insert characters (likely 
one at at time if I read you correctly) without allocating new storage 
each time (unless you've made the buffer too smal; in which case, double 
its size).

Then allocate the right amount of space for a string once and copy 
the buffer into it when the string has been completely read in.

-- hendrik

-- 
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/20200628190739.tpjrkilrf5eq546w%40topoi.pooq.com.


[racket-users] xml vs sxml?

2020-06-27 Thread Hendrik Boom
On Sat, Jun 27, 2020 at 12:33:02AM -0400, Neil Van Dyke wrote:
> I think anyone using XML or HTML seriously with Racket should probably at
> least be told of the SXML family of tools.  And warned about the
> compatibility problems.
> 
> Though not tell them *everywhere* XML in the docs.  For example, I
> figure a tutorial for Racket Web Server shouldn't distract readers with
> that.
> 
> As you know, :) there are some useful tools using SXML, and Oleg's SSAX
> parser has some different properties than core Racket's XML parser.
> 
> Complication: The incompatibility between SXML and core Racket's
> representations of XML is an unfortunate accident of parallel
> invention, and I think will tend to be confusing to new people.  I once
> tried to address the confusion in the `sxml-intro` documentation package,
> "https://www.neilvandyke.org/racket/sxml-intro/;, and I'm unhappy with the
> result.  The details in my document say more than perhaps anyone will ever
> want to know, and, "optics"-wise, make the situation look worse than it
> actually is in practice.  I think you could do a more graceful job of this.

On the contrary; this is the kind of information I need when choosing 
between the various representations.

But in section 4. Appendix there is one bit of pervasive confusion:
you present several differences, but do not make it clear which way the 
difference goes.  When you say, for example, "The SXML keyword symbols 
may be lowercase", do you mean that SXML itseld allows this to be done 
to its keywords, or that it does not but that xexpr allows its SXML 
keywords to be lower case?

> 
> (Someday, someone might undertake the large task of SXML-ifying all the many
> non-SXML bits of Racket, and incidentally reunite Racket with the rest of
> the Scheme community in that regard.  I started, with one piece, but got
> interrupted. "https://www.neilvandyke.org/racket/rws-html-template/"  :)

>From this, and from the general drift of your sxml-intro, I surmise that 
the intent is for Racket to become fully SXML compliant, and new 
software should be written for SXML, not xexpr, if at all possible.
Is this correct, and is this Racket policy?  If so, it should be stated 
explicitly in the sxml-intro.  A statement like this (if not gainsaid by 
the opposite camp (if any)) would eliminate much of the confusion 
experienced by new users.  It should of course also be said in the xexpr 
documentation.

Finally, I seem to remember that one of the tools mentioned somewhere 
for handling xml turned out not to be findable.  I don't know any more 
if it was mentioned in your document or elsewhere, but it might be worth 
checking that the ones you mention are still available.

-- hendrik

-- 
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/20200627123304.p437hr3nykhfjs45%40topoi.pooq.com.


Re: [racket-users] Should I stop sending packages to the catalog?

2020-06-19 Thread Hendrik Boom
On Fri, Jun 19, 2020 at 01:09:08PM -0700, Brian Adkins wrote:
> 
> I'm hoping the main scenario I'm concerned about (a bug is introduced in an 
> update of a package) is rare, although that's exactly what motivated Alex 
> to create his system. If it is a rare scenario for me, then I'd like to do 
> the following:
> 
> 1) Develop & test locally while updating packages as needed
> 2) Prior to releasing to production, so *something* that effectively 
> snapshots my environment
> 3) Use the snapshot to deploy to production
> 
> Although I have some ideas about the "something" task, I still have to 
> finalize the procedure and try it out. One option is to simply use a 
> racksnap snapshot. What I'd like to do is to create a personal catalog that 
> represents the packages I currently have installed, but it doesn't appear 
> there's a super easy `raco pkg` command to do that - I still need to 
> research a bit. Either there is a command, or it seems like a relatively 
> straightforward thing to add.

Making a complete copy of everything stored under ~/.racket might make 
enough of a racket system snapshot on a GNU/Linux system.  I have no 
idea what to do on Windows, though.

-- hendrik

-- 
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/20200619204945.rj6kckxwmsvutag6%40topoi.pooq.com.


Re: [racket-users] Should I stop sending packages to the catalog?

2020-06-19 Thread Hendrik Boom
On Fri, Jun 19, 2020 at 07:54:29AM -0700, Brian Adkins wrote:
> On Friday, June 19, 2020 at 8:09:04 AM UTC-4, Neil Van Dyke wrote:
> >
> > For an important production system, you probably want the source of any 
> > third-party packages on which you depend to be in Git (or another SCM 
> > system) that you control. 
> >
> > You might also want to audit those packages yourself, as well as audit 
> > any new version changes to them, before you push to production. 
> >
> > After you do those things in SCM, depending how you do it, you *might* 
> > find it's more convenient to simply load the third-party code you need 
> > using the module system `require` only, without an additional package 
> > system. 
> >
> 
> While I see some benefits of this approach, I just looked at a typical 
> Rails project of mine, and it has over 160 packages with some packages 
> depending on different versions of other packages, etc., so I think 
> managing all of this myself in git might be overly burdensome. Granted, my 
> current Racket apps have far fewer dependencies, but I expect that may 
> increase over time. 

If you want to avoid problems with software you use changing 
unpredictably, you will have to have use your own copy that does not 
change at all.

I don't see another alternative if your upstream source might change at 
any time.

And you will likely have to vet any chaanges that appear upstream in 
case they actually do fix security-related issues that might already 
be affect you.  It will be up to you to determine the risks of leaving 
your local copy unchanged.

-- hendrik

> 
> -- 
> 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/32b8f70a-4033-43db-aca3-b30b9023f3a3o%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/20200619193649.ks3gffy7wfggakkg%40topoi.pooq.com.


[racket-users] About FEXPRS

2020-06-07 Thread Hendrik Boom
On Sun, Jun 07, 2020 at 08:09:40PM +0800, Siyuan Chen wrote:
...
...
> 
> There is an alternative of Lisp macros called FEXPRs, see
> https://en.wikipedia.org/wiki/Macro_(computer_science)#Early_Lisp_macros
> 
> > Early Lisp macros
> > Before Lisp had macros, it had so-called FEXPRs, function-like operators
> whose inputs were not the values computed by the arguments but rather the
> syntactic forms of the arguments, and whose output were values to be used
> in the computation. In other words, FEXPRs were implemented at the same
> level as EVAL, and provided a window into the meta-evaluation layer. This
> was generally found to be a difficult model to reason about effectively.

This wasn't just a feature for the expert user; it was the way basic 
primitives like 'quote', 'cond', and 'let' were implemented in the 
lisp 1.5 interpreter; the actual interpreting code being written in 
assembler (or Lisp, if it wasn't an utterly necessary primitive).

-- hendrik

> 
> More information, see https://en.wikipedia.org/wiki/Fexpr
...
...

-- 
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/20200607160227.bmwnuh5cg4kvkren%40topoi.pooq.com.


Re: [racket-users] Poor documentation of List*

2020-06-03 Thread Hendrik Boom
On Wed, Jun 03, 2020 at 04:22:41PM +0100, Stephen De Gabrielle wrote:
> Hi Hendrik,
> 
> I can't see the example you mention in
> https://docs.racket-lang.org/ts-reference/type-ref.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fbase-types-extra..rkt%29._.List%2A%29%29
> 
> i'm assuming (List* c) is shorthand for (Pair c null)? I don't know typed
> racket so I've probably got that terribly wrong.

It might be.  But that's normally said as (List c), not List* c)
With your interpretation, List* qould be equivalent to List.

> 
> So while I can't help you with this - I wanted to encourage you to make a
> PR to the documentation if you come up with a fix.

My problem is that I don't know what the documentation is supposed to say.

-- hendrik

> It *used* to be hard to find the file that needs the fix, good steps have
> been made recently to make it easier to identify the documentation source
> file so it is easier to find and make the corrections or additions.
> 
> If you have any trouble let me know and I'll try help - I think I'm
> getting the hang of it.
> 
> Hope you are well
> 
> Kind regards
> 
> Stephen
> 
> ps i use
> https://blog.racket-lang.org/2017/09/tutorial-contributing-to-racket.html &
> lots of kind guidance from other racketeers :0
> pps: if you make a successful pr you get credit in the frankly wonderful
> racket news https://racket-news.com/2020/06/racket-news-issue-32.html
> 
> On Tue, Jun 2, 2020 at 3:13 PM Hendrik Boom  wrote:
> 
> > In the Typed Racket Reference, List* is defined as follows:
> >
> > (List* t t1 ... s)
> >
> > is equivalent to (Pairof t (List* t1 ... s)).
> >
> > Following this definition down, we get
> >
> > (List* a b c)
> >  -> (Pairof a (List* b c))
> >  -> (Pairof a (Pairof b (List* c)))
> >
> > But what's (List* c) ?
> >
> > I see no explanatory examples.
> >
> > -- hendrik
> >
> > P.S.  I'm also unsure what 'bound' is supposed to do in
> >
> > (List t ... trest ... bound)
> >
> > It says "where bound must be an identifier denoting a type variable
> > bound with ..." but I don't undestand what this is referring to.
> >
> > There are no examples of this in the document, just as there are no
> > examples of List*.
> >
> > -- hendrik
> >
> > --
> > 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/20200602141347.3z7igvzbjyikhfn4%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 racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAGHj7-LsML%2BeOnt_BUBWmRM5vU6GtovyaNr-JHOQPzoMCL2NTQ%40mail.gmail.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/20200603194902.27zjystdhecumoup%40topoi.pooq.com.


[racket-users] Poor documentation of List*

2020-06-02 Thread Hendrik Boom
In the Typed Racket Reference, List* is defined as follows:

(List* t t1 ... s)

is equivalent to (Pairof t (List* t1 ... s)).

Following this definition down, we get

(List* a b c)
 -> (Pairof a (List* b c))
 -> (Pairof a (Pairof b (List* c)))

But what's (List* c) ?

I see no explanatory examples.

-- hendrik

P.S.  I'm also unsure what 'bound' is supposed to do in 

(List t ... trest ... bound)

It says "where bound must be an identifier denoting a type variable 
bound with ..." but I don't undestand what this is referring to.

There are no examples of this in the document, just as there are no 
examples of List*.

-- hendrik

-- 
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/20200602141347.3z7igvzbjyikhfn4%40topoi.pooq.com.


Re: [racket-users] syntax woe with typed Racket 'let'

2020-06-01 Thread Hendrik Boom
On Mon, Jun 01, 2020 at 10:28:55PM -0500, Shu-Hung You wrote:
> FWIW, because `.` is just cons, the program
> (define (F [X : T1] . [Y : T2]) 'e)
> is being read as:
> (define (F [X : T1] Y : T2) 'e)
> I guess that's the reason for having an extra '*' in the syntax.

Indeed.  It works for untyped Racket, but in typed Racket that notation 
would become quite ambiguous.

-- hendrik

> 
> On Mon, Jun 1, 2020 at 10:16 PM Sam Tobin-Hochstadt
>  wrote:
> >
> > The syntax looks like this:
> >
> > (define (f [x : Number] . [y : String *]) : Number (+ x (length y)))
> >
> > See the documentation for `define` in Typed Racket here:
> > https://docs.racket-lang.org/ts-reference/special-forms.html?q=define#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._define%29%29
> > in particular the `rst` production.
> >
> > Sam
> >
> > On Mon, Jun 1, 2020 at 3:09 PM Hendrik Boom  wrote:
> > >
> > > On Mon, Jun 01, 2020 at 10:58:09AM -0400, Sam Tobin-Hochstadt wrote:
> > > > Do you perhaps have some other binding shadowing the binding of `:`
> > > > from Typed Racket? That produces the error message you get when I try
> > > > it.
> > >
> > > Not intentionally.  I'll have to look carefully for possible candidates.
> > > Or ask DrRacket to jump to a binding occurrence.
> > >
> > > Did that:  It wouldn't find a bining instance while that colon was
> > > there, but complained about the syntax error I was sompaining about.
> > > But when I removed the type specification from the let-clause and
> > > introuced a colon elsewhere in the function as an extra parameter in
> > > another expression, it would find the binding.  It turned out that the
> > > binding occurrence was the colon in the tail-parameter [args : T-Size].
> > >
> > > So I have to ask, what *is* the proper way to indicate that the
> > > function can be called with many more parameters, which are to be
> > > made available as a list?
> > >
> > > Thank you for the hint.
> > >
> > > -- hendrik
> > >
> > > >
> > > > Sam
> > > >
> > > > On Sat, May 30, 2020 at 1:32 PM Hendrik Boom  
> > > > wrote:
> > > > >
> > > > > I'm sorry to keep pestering this list, but I'm out of my depth with 
> > > > > the
> > > > > detailed syntax (and semantics) of typed Racket.  But I'm doggedly
> > > > > ploughing on.
> > > > >
> > > > > I'm having trouble with the 'let' line in the 'pointer-to' function 
> > > > > listed later:
> > > > >
> > > > > (let ([vt : Ffi-type (cast ((inst hash-ref Ffi-type Ffi-type) 
> > > > > type-to-vector type #f) Ffi-type)])
> > > > >
> > > > > Yes, there's an unbalanced parenthesis because this sin't the end of 
> > > > > the let-expression.
> > > > >
> > > > > The error message is
> > > > >
> > > > >  let: expected type-annotated identifier
> > > > >   parsing context:
> > > > >while parsing annotated-binding
> > > > >while parsing optionally type-annotated binding in: (vt : Ffi-type 
> > > > > (cast ((inst hash-ref Ffi-type Ffi-type) type-to-vector type #f) 
> > > > > Ffi-type))
> > > > >
> > > > > I can't see the error.  'vt : Ffi-type' looks like a type-annotated
> > > > > identifier to me.  And it seems to have the right number of 
> > > > > parentheses
> > > > > in front of it, followed by an expression whose vlue is to be bound to
> > > > > 'vt'.
> > > > >
> > > > > Here's the function it's part of:
> > > > >
> > > > >
> > > > > (define (pointer-to [type : T-Type] . [args : T-Size]) : T-Type ; 
> > > > > TODO: rename args to size-args
> > > > >   (if (and (equal? args '(1)) (not (eq? type '_void)))
> > > > > (mode-dependent-type
> > > > >   `(_ptr i ,type) `(_ptr o ,type))
> > > > > (case type
> > > > >   ((_void) '_pointer/intptr)
> > > > >   ((_byte _uint8) (mode-dependent-type
> > > > > '_string*/utf-8
> > > > > (if (null? args)
> > > > >   '_bytes
> > > > >   `(

Re: [racket-users] syntax woe with typed Racket 'let'

2020-06-01 Thread Hendrik Boom
On Mon, Jun 01, 2020 at 10:58:09AM -0400, Sam Tobin-Hochstadt wrote:
> Do you perhaps have some other binding shadowing the binding of `:`
> from Typed Racket? That produces the error message you get when I try
> it.

Not intentionally.  I'll have to look carefully for possible candidates.
Or ask DrRacket to jump to a binding occurrence.

Did that:  It wouldn't find a bining instance while that colon was 
there, but complained about the syntax error I was sompaining about.
But when I removed the type specification from the let-clause and 
introuced a colon elsewhere in the function as an extra parameter in 
another expression, it would find the binding.  It turned out that the 
binding occurrence was the colon in the tail-parameter [args : T-Size].

So I have to ask, what *is* the proper way to indicate that the 
function can be called with many more parameters, which are to be 
made available as a list?

Thank you for the hint.

-- hendrik

> 
> Sam
> 
> On Sat, May 30, 2020 at 1:32 PM Hendrik Boom  wrote:
> >
> > I'm sorry to keep pestering this list, but I'm out of my depth with the
> > detailed syntax (and semantics) of typed Racket.  But I'm doggedly
> > ploughing on.
> >
> > I'm having trouble with the 'let' line in the 'pointer-to' function listed 
> > later:
> >
> > (let ([vt : Ffi-type (cast ((inst hash-ref Ffi-type Ffi-type) 
> > type-to-vector type #f) Ffi-type)])
> >
> > Yes, there's an unbalanced parenthesis because this sin't the end of the 
> > let-expression.
> >
> > The error message is
> >
> >  let: expected type-annotated identifier
> >   parsing context:
> >while parsing annotated-binding
> >while parsing optionally type-annotated binding in: (vt : Ffi-type (cast 
> > ((inst hash-ref Ffi-type Ffi-type) type-to-vector type #f) Ffi-type))
> >
> > I can't see the error.  'vt : Ffi-type' looks like a type-annotated
> > identifier to me.  And it seems to have the right number of parentheses
> > in front of it, followed by an expression whose vlue is to be bound to
> > 'vt'.
> >
> > Here's the function it's part of:
> >
> >
> > (define (pointer-to [type : T-Type] . [args : T-Size]) : T-Type ; TODO: 
> > rename args to size-args
> >   (if (and (equal? args '(1)) (not (eq? type '_void)))
> > (mode-dependent-type
> >   `(_ptr i ,type) `(_ptr o ,type))
> > (case type
> >   ((_void) '_pointer/intptr)
> >   ((_byte _uint8) (mode-dependent-type
> > '_string*/utf-8
> > (if (null? args)
> >   '_bytes
> >   `(_bytes o ,@ args
> >   (else
> > (let ([vt : Ffi-type (cast ((inst hash-ref Ffi-type Ffi-type) 
> > type-to-vector type #f) Ffi-type)])
> >   (if vt
> > (mode-dependent-type
> >   `(,vt i)
> >   (if (null? args)
> > vt
> > `(,vt o ,@ args)))
> > (mode-dependent-type
> >   `(_vector i ,type)
> >   (if (null? args)
> > '_pointer
> > `(_vector o ,type ,@ args)
> >
> > --
> > 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/20200530173230.bsrp5skkc35ot34h%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 racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAK%3DHD%2BYkANXdevMc%3DiSTFaWnpzU-6ofNWF2qJtWyR-f6ES2gLg%40mail.gmail.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/20200601190913.hxaqlgfm7y6prm5p%40topoi.pooq.com.


[racket-users] syntax woe with typed Racket 'let'

2020-05-30 Thread Hendrik Boom
I'm sorry to keep pestering this list, but I'm out of my depth with the 
detailed syntax (and semantics) of typed Racket.  But I'm doggedly 
ploughing on.

I'm having trouble with the 'let' line in the 'pointer-to' function listed 
later:

(let ([vt : Ffi-type (cast ((inst hash-ref Ffi-type Ffi-type) type-to-vector 
type #f) Ffi-type)])

Yes, there's an unbalanced parenthesis because this sin't the end of the 
let-expression.

The error message is

 let: expected type-annotated identifier
  parsing context: 
   while parsing annotated-binding
   while parsing optionally type-annotated binding in: (vt : Ffi-type (cast 
((inst hash-ref Ffi-type Ffi-type) type-to-vector type #f) Ffi-type))

I can't see the error.  'vt : Ffi-type' looks like a type-annotated 
identifier to me.  And it seems to have the right number of parentheses 
in front of it, followed by an expression whose vlue is to be bound to 
'vt'.

Here's the function it's part of:


(define (pointer-to [type : T-Type] . [args : T-Size]) : T-Type ; TODO: rename 
args to size-args
  (if (and (equal? args '(1)) (not (eq? type '_void)))
(mode-dependent-type
  `(_ptr i ,type) `(_ptr o ,type))
(case type
  ((_void) '_pointer/intptr)
  ((_byte _uint8) (mode-dependent-type 
'_string*/utf-8 
(if (null? args)
  '_bytes
  `(_bytes o ,@ args
  (else
(let ([vt : Ffi-type (cast ((inst hash-ref Ffi-type Ffi-type) 
type-to-vector type #f) Ffi-type)])
  (if vt
(mode-dependent-type
  `(,vt i)
  (if (null? args) 
vt
`(,vt o ,@ args))) 
(mode-dependent-type
  `(_vector i ,type)
  (if (null? args) 
'_pointer
`(_vector o ,type ,@ args)

-- 
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/20200530173230.bsrp5skkc35ot34h%40topoi.pooq.com.


[racket-users] coding style query

2020-05-27 Thread Hendrik Boom
Is there an accepted convention about how to use a symbol used in a 
program within a comment so it's clear the comment is using it as a 
program symbol and not as an ordinary English word?

-- hendrik

-- 
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/20200527175636.6f23slgqphlo3sfk%40topoi.pooq.com.


Re: [racket-users] inconvenience in typed Racket

2020-05-22 Thread Hendrik Boom
On Fri, May 22, 2020 at 05:35:04PM -0400, Sam Tobin-Hochstadt wrote:
> The problem is almost certainly that `Any` is not allowed in 
> `Ffi-type`. What's the definition of `Ffi-type`,

Casting rettype to Any did not help; adding Any in as one of the options 
in ffi-type did let it go through.


It's completely obscure to me why inserting Any as an additional 
alternative in Ffi-type works.

But I don't *want* Any to be a valid alternative for Ffi-type anywhere 
else in the program.  It will let too much through.  I'm adding types to 
existing untyped code in an attempt to get some understanding of its 
data structures, and using Any here would not teach me anything.

I suppose I could cast rettype to a union Ffi-type and Any in situ.
Ugly.

 and why does `params`
> have a type that involves `Any`?

Because it has a lot af possiilities and I haven't yet gotten to 
figuring out what's really needed.

I think there's a need to embed untyped expressions in a typed program, 
just as there's a mechanism to do the reverse.

-- hendrik

> 
> Sam
> 
> On Fri, May 22, 2020 at 5:21 PM Hendrik Boom  
> wrote:
> >
> > Here's the code it's complaining about.
> >
> >  `(,@params -> ,rettype)
> >
> > And here's the message:
> >
> > Type Checker: Polymorphic function `qq-append' could not be applied 
> > to arguments: Types: (Listof a) (Listof b) -> (Listof (U a b)) 
> > Arguments: (Listof (List Any ': Any)) (List '-> Ffi-type) Expected 
> > result: Ffi-type
> >  in: (quasiquote ((unquote-splicing params) -> (unquote rettype)))
> >
> > Now what I'm building is a piece of Racket code that is to be 
> > written out into a new source-code file.
> >
> > param is indeed of type (Listof (List Any ': Any)). rettype is 
> > indeed of type (List '-> Ffi-type)
> >
> > And or some reason the type-checker isn't able to realise that I can 
> > really build a valid s-expression out of these components.
> >
> > Now i could hand-expand the quasiquote in to a lot of cons 
> > operations, each presummably surrounded by 'inst' becausee cons is 
> > polymorphic, but this will just make the entire expression 
> > unreadable.
> >
> > I'm almost tempted to write this expression in untyped Racket.
> >
> > But separating this stuff into another module would significantly 
> > demodularize the code -- related code will no longer be together.
> >
> > Racket does have a compact mechanism to embed typed-Racket code in 
> > an untyped program (it's called with-type)
> >
> > But there seems to be no similar way to embed an expression of 
> > untyped code into a typed-racket program.
> >
> > How to get past this impasse?  The majority of my code needs to be 
> > in typed Racket to maintain my sanity while debugging, but the 
> > quasiquoted texts (there are a number of these) need to be readable, 
> > for the same reason.
> >
> > -- hendrik
> >
> > -- 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/20200522212056.m3x54f6dykgs4qyx%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 
> racket-users+unsubscr...@googlegroups.com. To view this discussion on 
> the web visit 
> https://groups.google.com/d/msgid/racket-users/CAK%3DHD%2BZah-zmPNKX%3DyttQoQFs7pY9PHc8hYGzkTeKm35YU3MLg%40mail.gmail.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/20200523000420.6b7ntayaph22gmlq%40topoi.pooq.com.


[racket-users] inconvenience in typed Racket

2020-05-22 Thread Hendrik Boom
Here's the code it's complaining about.

 `(,@params -> ,rettype)

And here's the message:

Type Checker: Polymorphic function `qq-append' could not be applied to 
arguments:
Types: (Listof a) (Listof b) -> (Listof (U a b))
Arguments: (Listof (List Any ': Any)) (List '-> Ffi-type)
Expected result: Ffi-type
 in: (quasiquote ((unquote-splicing params) -> (unquote rettype)))

Now what I'm building is a piece of Racket code that is to be written 
out into a new source-code file. 

param is indeed of type (Listof (List Any ': Any)).
rettype is indeed of type (List '-> Ffi-type)

And or some reason the type-checker isn't able to realise that I can 
really build a valid s-expression out of these components.

Now i could hand-expand the quasiquote in to a lot of cons operations, 
each presummably surrounded by 'inst' becausee cons is polymorphic,
but this will just make the entire expression unreadable.

I'm almost tempted to write this expression in untyped Racket.

But separating this stuff into another module would significantly 
demodularize the code -- related code will no longer be together.

Racket does have a compact mechanism to embed typed-Racket code in an 
untyped program (it's called with-type)

But there seems to be no similar way to embed an expression of untyped 
code into a typed-racket program.

How to get past this impasse?  The majority of my code needs to be in 
typed Racket to maintain my sanity while debugging, but the quasiquoted 
texts (there are a number of these) need to be readable, for the same 
reason.

-- hendrik

-- 
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/20200522212056.m3x54f6dykgs4qyx%40topoi.pooq.com.


Re: [racket-users] Inference for polymorphic functions not supported?

2020-05-19 Thread Hendrik Boom
On Mon, May 18, 2020 at 04:51:26PM -0400, Sam Tobin-Hochstadt wrote:
> The systematic way to do it is to use `inst`.
> 
> Here's the first example:
> 
> (define hash-list : (Listof (Pair Symbol Natural)) (list))
> ((inst sort (Pair Symbol Natural) String) hash-list string ((p : (Pair Symbol Natural))) (symbol->string (car p))) #:cache-keys?
> #t)
> 
> This program works already, but I wasn't sure what the `y` binding was
> doing in your second example:
> 
> (for*/list : (Listof (Pair Symbol Natural)) ((p : (Pair Symbol
> Natural) (in-list hash-list))
>  (k : Symbol (in-value (car p)))
>  (v : Natural (in-value (cdr p)))
>  #:when (not (= v 1))
>  )
>   (cons k v))

I got this second example to work, but it's still a black art to me.

 (printf "~s~%"
`(define pname-map (hasheqv
 ,@(for*/list : (Listof (List Symbol Natural))
 ((p  : (Pair Symbol Natural)(in-list 
(hash->sorted-list pname-map)))
  (k : Symbol (in-value (car p)))
  (v : Natural (in-value (cdr p)))
  #:when (not (= v 1))
  )
 (list k v) ; TODO: I changed this; 
original used a temporary variable 'y'.
 

I really had to get rid of the y variable.  Even providing an explicit type for 
that 
variable did not work.

It kept complaining about the overloaded function 'cons'.

Presumably I'd have to use inst on the 'cons' function to clear this up 
comprehensibly, 
but 'cons' does not appear explicitly in the code at all.

It's probably embedded in the code generated by quasiquote.  The 'inst' tril 
doesn't 
work very well on code generated by a macro when the macro itself doesn't 
generate 
'inst's.

I do not understand how eliminating the temporary variably 'y' made it all work.

-- hendrik

> 
> Sam
> 
> On Mon, May 18, 2020 at 4:33 PM Hendrik Boom  wrote:
> >
> > I keep getting the messages like
> >
> > Type Checker: Inference for polymorphic keyword functions not supported in: 
> > (sort hash-list string > (symbol->string (car p))) #:cache-keys? #t)
> >
> > or
> >
> > Type Checker: Polymorphic function `cons' could not be applied to arguments:
> > Types: a (Listof a) -> (Listof a)
> >a b -> (Pairof a b)
> > Arguments: (U Exact-Nonnegative-Integer Symbol) (Listof (Pairof Symbol 
> > Nonnegative-Integer))
> > Expected result: (Listof (Pairof Symbol Nonnegative-Integer))
> >  in: (for*/list : (Listof (Pair Symbol Natural)) ((p : (Pair Symbol 
> > Natural) (in-list (hash->sorted-list pname-map))) (k : Symbol (in-value 
> > (car p))) (v : Natural (in-value (cdr p))) #:when (not (= v 1)) (y (list k 
> > v))) y)
> >
> > Is there some systematic way to code this explicitly so it
> > doesn't have to try guesswork? (hich it refuses to do)
> >
> > And is it really unable to figure out that an
> > Exact-Nonnegative-Integer is a Nonnegative-Integer?
> >
> > -- hendrik
> >
> > --
> > 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/20200518203342.4vcvrsrvkmld4tmh%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 racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200519105800.gwojekkthcexivbz%40topoi.pooq.com.


Re: [racket-users] Inference for polymorphic functions not supported?

2020-05-18 Thread Hendrik Boom
On Mon, May 18, 2020 at 04:51:26PM -0400, Sam Tobin-Hochstadt wrote:
> The systematic way to do it is to use `inst`.
> 
> Here's the first example:
> 
> (define hash-list : (Listof (Pair Symbol Natural)) (list))
> ((inst sort (Pair Symbol Natural) String) hash-list string ((p : (Pair Symbol Natural))) (symbol->string (car p))) #:cache-keys?
> #t)
> 
> This program works already, but I wasn't sure what the `y` binding was
> doing in your second example:

I don't either.  It was originally someone else's program, which I'm coverting 
to typed 
Racket in order to understand it better.

-- hendrik

> 
> (for*/list : (Listof (Pair Symbol Natural)) ((p : (Pair Symbol
> Natural) (in-list hash-list))
>  (k : Symbol (in-value (car p)))
>  (v : Natural (in-value (cdr p)))
>  #:when (not (= v 1))
>  )
>   (cons k v))
> 
> Sam
> 
> On Mon, May 18, 2020 at 4:33 PM Hendrik Boom  wrote:
> >
> > I keep getting the messages like
> >
> > Type Checker: Inference for polymorphic keyword functions not supported in: 
> > (sort hash-list string > (symbol->string (car p))) #:cache-keys? #t)
> >
> > or
> >
> > Type Checker: Polymorphic function `cons' could not be applied to arguments:
> > Types: a (Listof a) -> (Listof a)
> >a b -> (Pairof a b)
> > Arguments: (U Exact-Nonnegative-Integer Symbol) (Listof (Pairof Symbol 
> > Nonnegative-Integer))
> > Expected result: (Listof (Pairof Symbol Nonnegative-Integer))
> >  in: (for*/list : (Listof (Pair Symbol Natural)) ((p : (Pair Symbol 
> > Natural) (in-list (hash->sorted-list pname-map))) (k : Symbol (in-value 
> > (car p))) (v : Natural (in-value (cdr p))) #:when (not (= v 1)) (y (list k 
> > v))) y)
> >
> > Is there some systematic way to code this explicitly so it
> > doesn't have to try guesswork? (hich it refuses to do)
> >
> > And is it really unable to figure out that an
> > Exact-Nonnegative-Integer is a Nonnegative-Integer?
> >
> > -- hendrik
> >
> > --
> > 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/20200518203342.4vcvrsrvkmld4tmh%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 racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200518221533.uwflu2ulyzeolcmv%40topoi.pooq.com.


[racket-users] Inference for polymorphic functions not supported?

2020-05-18 Thread Hendrik Boom
I keep getting the messages like

Type Checker: Inference for polymorphic keyword functions not supported in: 
(sort hash-list stringstring 
(car p))) #:cache-keys? #t)

or

Type Checker: Polymorphic function `cons' could not be applied to arguments:
Types: a (Listof a) -> (Listof a)
   a b -> (Pairof a b)
Arguments: (U Exact-Nonnegative-Integer Symbol) (Listof (Pairof Symbol 
Nonnegative-Integer))
Expected result: (Listof (Pairof Symbol Nonnegative-Integer))
 in: (for*/list : (Listof (Pair Symbol Natural)) ((p : (Pair Symbol Natural) 
(in-list (hash->sorted-list pname-map))) (k : Symbol (in-value (car p))) (v : 
Natural (in-value (cdr p))) #:when (not (= v 1)) (y (list k v))) y)

Is there some systematic way to code this explicitly so it 
doesn't have to try guesswork? (hich it refuses to do)

And is it really unable to figure out that an 
Exact-Nonnegative-Integer is a Nonnegative-Integer? 

-- hendrik

-- 
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/20200518203342.4vcvrsrvkmld4tmh%40topoi.pooq.com.


[racket-users] SOLVED BUT needs documentation change: printing structures in typed Racket

2020-05-15 Thread Hendrik Boom
On Fri, May 15, 2020 at 10:07:31AM -0400, Sam Tobin-Hochstadt wrote:
> Generics are not supported yet; you need to use structure type
> properties, like this:
> 
> #lang typed/racket/base
> 
> (: parameter-print : Any Output-Port Any -> Any)
> (define (parameter-print v p b) (fprintf p "hi\n"))
> 
> (struct parameter
>   ([type : String] [name : Symbol] [len : (Option String)] [const? :
> Boolean] [stars : Integer])
>   #:property prop:custom-write  parameter-print)

Thank you.  That worked.

But according to section 2.5 of the typed Racket reference, #:property 
is not one of the allowed options in struct.

Perhaps the documentation needs to be updated/

-- hendrik
 
> 
> On Fri, May 15, 2020 at 8:00 AM Hendrik Boom  wrote:
> >
> > How does one provide a method to print strutures in typed Racket?
> >
> > (struct parameter
> >
> >   ([type : XML] [name : Symbol] [len : (Option String)] [const? : Boolean] 
> > [stars : Integer])
> >   #:methods gen:custom-write [(define write-proc parameter-print)]
> >   )
> >
> > seems not to work.  But something like this did work in untyped Racket.
> > Is there some other way to do this?
> >
> > -- hendrik
> >
> > --
> > 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/20200515120026.ski2o43crgtnsnr3%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 racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAK%3DHD%2BZFMR0evj%2B%3DcoeQaaQ602f7rGj76HtNc7N3bswipH7aEg%40mail.gmail.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/20200515143347.ceg34vkaelx6sdu2%40topoi.pooq.com.


[racket-users] at sign in scribble

2020-05-15 Thread Hendrik Boom
I hae not been able to figure out from the scribble documentation how to 
produce a document containing an at sign.

Just putting the desired at sign into the source file of course doesn't 
work, since the at-reader intercepts it. 

-- hendrik


-- 
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/20200515120418.yunluqvjoshcf4lj%40topoi.pooq.com.


[racket-users] printing structures in typed Racket

2020-05-15 Thread Hendrik Boom
How does one provide a method to print strutures in typed Racket?

(struct parameter
 
  ([type : XML] [name : Symbol] [len : (Option String)] [const? : Boolean] 
[stars : Integer])
  #:methods gen:custom-write [(define write-proc parameter-print)]
  )

seems not to work.  But something like this did work in untyped Racket.
Is there some other way to do this?

-- hendrik

-- 
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/20200515120026.ski2o43crgtnsnr3%40topoi.pooq.com.


Re: [racket-users] Re: Requesting feedback on CSS3 parser and tokenizer

2020-05-12 Thread Hendrik Boom
On Tue, May 12, 2020 at 05:35:59PM -0700, Alex Harsanyi wrote:
> I now very little about web technologies and web development, so this might 
> be a stupid question:  could you explain what types of applications might 
> need a to parse CSS files?  I can only think of one, and that is a web 
> browser.  Are you working towards a web browser in Racket?

I think CSS can also be used in .odt format files.  Not sure, though.
Don't have my .odt manual at hand.
And in .epub files.

-- hendrik

> 
> Alex.
> 
> On Wednesday, May 13, 2020 at 6:37:22 AM UTC+8, Sage Gerard wrote:
> >
> > I'm working to release a CSS3 tokenizer and parser to the catalog 
> > tomorrow. 
> >
> > https://github.com/zyrolasting/css3-syntax
> >
> > The current state lacks tests, so any logic errors should keep me busy for 
> > a little longer. I'm here to ask for bug reports and feedback in the issue 
> > tracker since I had my head in the weeds long enough. 
> 
> -- 
> 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/268eace0-f69e-44d4-b59c-13ef767d1108%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/20200513033923.h4tbljscffhi3v66%40topoi.pooq.com.


[racket-users] SOLVED: Mysterious multiple values in a typed-racket program

2020-05-09 Thread Hendrik Boom
On Sat, May 09, 2020 at 12:24:16PM -0400, Ben Greenman wrote:
> On 5/9/20, Hendrik Boom  wrote:
> > I get the message
> >
> > readspec.rkt:195:8: Type Checker: Expression should produce 3 values, but
> > produces 1 values of types String in: (for/set : (Setof String) (((l :
> > String) (cast (in-lines input-port) (Sequenceof String (cast
> > (string-trim l) String))
> >
> > from the following function:
> >
> > (define (read-manpages [input-port : Input-Port])
> >   (cast (for/set : (Setof String) (([l : String] (cast (in-lines input-port)
> > (Sequenceof String
> >(cast (string-trim l) String))
> > (Setof String)))
> >
> > The expression it is complaining about is the (for/list ..)
> > construction.
> >
> > I'm trying to covert a Racket program to a typed Racket program.
> > As far as I can see, this function reads words, one to a line, from
> > input-port and makes a set of these words.
> >
> > It baffles me where the type checker gets the idea that 3 values are wanted
> >
> > anywhere.
> >
> > I put in a lot of casts just to make sure I knew what types it had to work
> > with.
> >
> > The original code, without types:
> >
> > (define (read-manpages input-port)
> >   (for/set ((l (in-lines input-port)))
> >(string-trim l)))
> >
> > Any ideas?
> 
> Well this is unfortunate.
> 
> `(l : String)` should be `l : String` with no parentheses

Got it. It's confusing whenyuo need the parentheses around a type-binding and 
when you don't. 

-- hendrik

> 
> The code you have looks like this to Typed Racket:
> 
> ```
> (for/set : TYPE
>   (((val0 val1 val2) (in-lines input-port)))
>   LOOP-BODY)
> ```
> 
> -- 
> 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/CAFUu9R7wBS_hbZpXmFR097qxi8F-54rkogEXe6R0Nyqp_iMqDQ%40mail.gmail.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/20200509181040.iwzvd4un2btgcf4w%40topoi.pooq.com.


[racket-users] Mysterious multiple values in a typed-racket program

2020-05-09 Thread Hendrik Boom
I get the message 

readspec.rkt:195:8: Type Checker: Expression should produce 3 values, but 
produces 1 values of types String in: (for/set : (Setof String) (((l : String) 
(cast (in-lines input-port) (Sequenceof String (cast (string-trim l) 
String))

from the following function:

(define (read-manpages [input-port : Input-Port])
  (cast (for/set : (Setof String) (([l : String] (cast (in-lines input-port) 
(Sequenceof String
   (cast (string-trim l) String))
(Setof String)))

The expression it is complaining about is the (for/list ..) construction.

I'm trying to covert a Racket program to a typed Racket program.
As far as I can see, this function reads words, one to a line, from 
input-port and makes a set of these words.

It baffles me where the type checker gets the idea that 3 values are wanted 
anywhere.

I put in a lot of casts just to make sure I knew what types it had to work 
with.

The original code, without types:

(define (read-manpages input-port)
  (for/set ((l (in-lines input-port)))
   (string-trim l)))

Any ideas?

-- hendrik

-- 
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/20200509153840.ebbxgpzazrhdbldq%40topoi.pooq.com.


Re: [racket-users] for/set

2020-05-08 Thread Hendrik Boom
On Fri, May 08, 2020 at 04:18:24PM -0700, Sorawee Porncharoenwase wrote:
> There’s a search bar in the top left of every doc page.

Somehow I hadn't noticed that.  It's a huge help to know that.

> Typing for/set and
> enter will show you this search result page
> <https://docs.racket-lang.org/search/index.html?q=for%2Fset>. Here, the first
> result
> <https://docs.racket-lang.org/reference/sets.html?q=for%2Fset#%28form._%28%28lib._racket%2Fset..rkt%29._for%2Fset%29%29>
> is what you want.

Excellemt!

-- hendrik


> 
> On Fri, May 8, 2020 at 4:07 PM Hendrik Boom  wrote:
> 
> > Where is for/set documented?  What does it do?
> >
> > It is mentioned in the typed Racket menual, but oly to say it has
> > the same meaning as the unannotated version.
> >
> > -- hendrik
> >
> > --
> > 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/20200508230711.llav2273e2ntzegz%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 racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CADcuegvGez14Nxs9XhgoM_3tNViqWLtbhvikLnN%3D0zH4GEKY%2Bg%40mail.gmail.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/20200508233743.qmtmeyua2vmvbjvp%40topoi.pooq.com.


[racket-users] for/set

2020-05-08 Thread Hendrik Boom
Where is for/set documented?  What does it do?

It is mentioned in the typed Racket menual, but oly to say it has 
the same meaning as the unannotated version. 

-- hendrik

-- 
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/20200508230711.llav2273e2ntzegz%40topoi.pooq.com.


Re: [racket-users] Finding bound occurrences

2020-05-07 Thread Hendrik Boom
On Thu, May 07, 2020 at 10:27:53AM -0500, Robby Findler wrote:
> Does the file without arrows have a syntax error?
> 
> Robby

That was th problem.  Not in the file itself, which the main file 
for the Racket openGL binding, but in a generated file I included.

I forgot I had modified the include linr for debugging that other 
file.

Thanks.  I'm still learning.

-- hendrik

> 
> 
> On Thu, May 7, 2020 at 9:55 AM Hendrik Boom  wrote:
> 
> > I have several tabs open in DrRacket.
> > On two of them, when I mouse over a symbol, it provides very
> > visible links to binding or bound occurrences
> >
> > On the third, it doesn't.  There is a right-click mey item to jump
> > to the binding occurrence, but no menu item to find next bound
> > occurrence.
> >
> > One difference I've noticed is that that third tab has
> >   #lang racket/base
> > instead of
> >   #lang typed/racket
> > of
> >   #lang racket
> > like the first two tabs.
> >
> > Is this a bug or a feature?  Is there soe way I cn persuade it to
> > show me bound occurrences even in the third tab/
> >
> > -- hendrik
> >
> > --
> > 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/20200507145536.sflodxjyu5n72l3s%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 racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAL3TdONwrREEwFygXtVT%3D8ZPjWauL1uuEAfCfq5LRdFZTHnX7w%40mail.gmail.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/20200507215557.sn4uqkt5w3p27iwz%40topoi.pooq.com.


[racket-users] Finding bound occurrences

2020-05-07 Thread Hendrik Boom
I have several tabs open in DrRacket.
On two of them, when I mouse over a symbol, it provides very 
visible links to binding or bound occurrences

On the third, it doesn't.  There is a right-click mey item to jump 
to the binding occurrence, but no menu item to find next bound 
occurrence.

One difference I've noticed is that that third tab has
  #lang racket/base
instead of
  #lang typed/racket
of
  #lang racket
like the first two tabs.

Is this a bug or a feature?  Is there soe way I cn persuade it to 
show me bound occurrences even in the third tab/

-- hendrik

-- 
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/20200507145536.sflodxjyu5n72l3s%40topoi.pooq.com.


Re: [racket-users] Should I stop sending packages to the catalog?

2020-05-01 Thread Hendrik Boom
On Fri, May 01, 2020 at 06:12:55AM -0700, Jesse Alama wrote:
> On Thursday, April 30, 2020 at 2:57:45 PM UTC+2, Jay McCarthy wrote:
> >
> >
> > This is simply a social standard though. There is nothing that 
> > technically prevents you from breaking compatibility, except that your 
> > users may be upset. You can post things on the package server that 
> > follows any rules you want, including conflicting with any other 
> > packages.
> >
> 
> I'd like to second this point. There's nothing stopping you from pushing 
> whatever you want to your repo, and hence distributing whatever you want 
> via the package server. I've pushed breaking changes to my packages before, 
> and no one has complained, so I guess I didn't break any part of the 
> interface that they were using. (Or I have no users of my stuff at all, 
> which is certainly possible!)
> 
> I don't know how many packages mention, in their description, that they're 
> experimental, explicitly warning me that the interface is unstable and 
> likely to change. I use 'em anyway because they offer useful functionality. 
> I don't recall being nailed by breaking changes, but perhaps I'm just 
> getting lucky.
> 
> What exactly is the claim, anyway, about the package server not allowing 
> breaking changes? Is it that if you do a breaking change to your package, 
> then it's possible that other people's packages correspondingly break? If 
> so, then I think that's not a very interesting claim. Does the claim at 
> issue just amount to a restatement of the ethos that Jay mentioned about 
> trying to ensure backwards compatibility for a long time?
> 
> (All this said, I'd like to learn more about setting up custom package 
> catalogs, as Alex mentioned, to take matters even more into your own hands.)

Is there a mechanism for, when you know you are making a breaking change 
in a package, at least being warned about other packages that may break 
as a result?

And is there a mechanism for testing those other packages before 
committing your breaking package to the public repository?

-- hendrik
> 
> -- 
> 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/04ebf61c-54b3-4f58-96aa-f5bdc5f2b457%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/20200501132344.4nwjgebdlyttwkzu%40topoi.pooq.com.


Re: [racket-users] Reducing parentheses without language damage.

2020-05-01 Thread Hendrik Boom
On Thu, Apr 30, 2020 at 02:40:00PM -0700, Sorawee Porncharoenwase wrote:
> 
> This is Nia's parendown: https://docs.racket-lang.org/parendown/index.html

Just wondering:  Is there a way to write division if Nia's parendown is in 
effect?
There would be no problem with this if it was originally designed into the 
language,
but language add-ons give the probem of syntax-versus-name confliicts.

-- hendrik

-- 
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/20200501131750.seligwkp7zifoddu%40topoi.pooq.com.


  1   2   3   4   >