Re: [racket-users] multi line scribble text body in web-server template

2020-11-01 Thread Jay McCarthy
This section of the documentation discusses a similar issue that may help
you:

https://docs.racket-lang.org/web-server/templates.html?q=web%20server#%28part._.Gotchas__.Iteration%29

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


On Sun, Nov 1, 2020 at 12:22 PM Ben Greenman 
wrote:

> Thats the nor
>
> On 11/1/20, krs...@gmail.com  wrote:
> >
> > Hi!,
> >
> > I am using web-server/templates
> > <https://docs.racket-lang.org/web-server/templates.html?q=web%20server>.
> > I am confused why this just displays the last line?:
> >
> > @when[#t]{
> > first
> > second
> > }
>
> That's normal "when" behavior
>
> ```
> Welcome to Racket v7.8.0.5 [cs].
> > (when #t "first" "second")
> "second"
> ```
>
> One fix is to put a list of text in the `when` body. He's how I'd write it:
>
> ```
> #lang at-exp racket
>
> @(define (when-logged-in . pc*)
>(when #t
>  pc*))
>
> @when-logged-in{
>   first
>   second
> }
> ```
>
> --
> 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/CAFUu9R5y6%2B6dCeEYEYRTmKVcHr%3DgZQ9UbztXyy82hKD6AxjPNA%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/CAJYbDanKtsLhNXG8T2jo5MGsk9n8hZv5nHd0DbhVS%3DXR46ZLdw%40mail.gmail.com.


[racket-users] RacketCon, join today! For freedom!

2020-10-16 Thread Jay McCarthy
https://con.racket-lang.org/

Young people from all over the globe are joining RacketCon to fight for the
future!

"I'm doing my part!", says Samantha Lambdanopolus, as she joins the Gather.

"I'm doing my part!", says Mack "Macro" Ronaldson, as he tweets his friends.

"I'm doing my part!", says Charles Donald Roy, as they think of questions
for the speakers.

"I'm doing my part, too!", says J. S. Hacker, to the numberless laughter of
the crowd.

Are you doing your part? Join RacketCon today and save the world!

https://con.racket-lang.org/

Joining guarantees a good time!

https://con.racket-lang.org/

What's stopping you? Do you want to live forever?

https://con.racket-lang.org/

A message from the Racket News Network

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

-- 
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/CAJYbDamjwd8dTeoFzdG7vvGgcZ2uxxPrqtzz45qM2FLeFNoRxg%40mail.gmail.com.


[racket-users] RacketCon is next weekend!

2020-10-09 Thread Jay McCarthy
To the friends and followers of Racket,

You have produced thousands of commits since last Con. You have honored
your ancestors and brought glory to Racket. RacketCon is next weekend, from
Friday to Sunday, come and see.

https://con.racket-lang.org/

Kathi Fisler will keynote, and we will hear about distribution from Webber
and computation from Konrad, come and see.

https://con.racket-lang.org/

I want you to hear about Brian's web framework and Sage's dependency
tracker. Attend RacketCon for free and these worries will no longer trouble
you. If you don't watch, then you'll miss Pierce on randomness and Gustavo
on type recovery. You won't take part in the Racket town hall, or hear
about Jesse's riposte, Peter's contract generator, or Panicz's sketches.
Stephen's games will be less fun and Ben will shallowly type to no one but
me. Come and see.

https://con.racket-lang.org/

Come and see, come and see, attendance is free, come and see:

https://con.racket-lang.org/

Tweet your friends and your bros, to please come and see.

Jay

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

-- 
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/CAJYbDa%3DhzCXRRycZUig3rFfhzfcw-yUjxB-9aqKOWYjgXJ9gmw%40mail.gmail.com.


Re: [racket-users] [racket users] scribble using @ as text?

2020-09-24 Thread Jay McCarthy
I went too fast: @"@"

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


On Thu, Sep 24, 2020 at 5:30 PM Jay McCarthy  wrote:

> @["@"]
>
> --
> Jay McCarthy
> Associate Professor @ CS @ UMass Lowell
> http://jeapostrophe.github.io
> Vincit qui se vincit.
>
>
> On Thu, Sep 24, 2020 at 5:26 PM Kevin Forchione  wrote:
>
>> Hi guys,
>> I’ve been racking my brains and going through scribble manuals trying to
>> figure out how to do something as simple as proceed a sentence like: The @
>> is used in a scribble command. I’m sure I’m overlooking something very
>> basic, since the @ is referenced all over scribble documentation.
>>
>> Any help is appreciated!
>>
>> Kevin
>>
>> --
>> 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/8187F519-D648-472C-8B99-45B28DFD4BC0%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/CAJYbDa%3D3m2u%2B_stntZn-3R7in5geF4TFUScZNVGcNRXythPiUA%40mail.gmail.com.


Re: [racket-users] [racket users] scribble using @ as text?

2020-09-24 Thread Jay McCarthy
@["@"]

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


On Thu, Sep 24, 2020 at 5:26 PM Kevin Forchione  wrote:

> Hi guys,
> I’ve been racking my brains and going through scribble manuals trying to
> figure out how to do something as simple as proceed a sentence like: The @
> is used in a scribble command. I’m sure I’m overlooking something very
> basic, since the @ is referenced all over scribble documentation.
>
> Any help is appreciated!
>
> Kevin
>
> --
> 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/8187F519-D648-472C-8B99-45B28DFD4BC0%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/CAJYbDa%3DhPr-cLA1-9t0oVdC2y1sGRa4RWh_UmOudzj%2BNHLAmSg%40mail.gmail.com.


Re: [racket-users] New lightweight termios package: rktermios

2020-09-22 Thread Jay McCarthy
Hi Dom,

I think it would pretty easy to patch ansi. I already made this version:

https://github.com/jeapostrophe/racket-ansi/commit/10a46081499f93c65f4849402e862a683af7871a

which abstracts away the old extension. I think it would be really trivial
to use yours. Thanks!

Jay

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


On Mon, Sep 21, 2020 at 6:21 PM Dominik Pantůček <
dominik.pantu...@trustica.cz> wrote:

> Hello Racketeers,
>
> as I learned that it is not possible to use the ansi package under CS,
> because the C extensions do not work under CS, I decided to put together
> a minimalistic termios wrapper using only Racket code.
>
> It provides the bare minimum to set the terminal to "raw" mode and
> should work under any POSIX system (tested on Linux and NetBSD). Usage
> is VERY simple[1].
>
> The ansi package can be patched immediately to use it and therefore work
> under CS and charterm can be probably be patched as well - meaning it
> will no longer rely on `stty' for this functionality.
>
> The termios package uses similar approach but tries to implement all
> termios capabilities which means it has to compile at least the
> constants from termios headers. The same applies for serial package. It
> might be possible to generate a .rkt file with those constants from the
> header files during package build - but I didn't investigate that yet.
>
> Any feedback is, of course, welcome. And all the ideas mentioned are
> only suggestions.
>
>
> Cheers,
> Dominik
>
> [1] https://docs.racket-lang.org/rktermios/index.html
>
> --
> 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/756b73f6-919e-fef2-b81c-7ad19fa1378c%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/CAJYbDanYwLcLF_MuwMNufSFQTR%3DaXR4MqY4whK5-TEXK3gwBzQ%40mail.gmail.com.


[racket-users] Re: (chaperone RacketCon) 2020

2020-09-03 Thread Jay McCarthy
The site is up with speakers and times:

https://con.racket-lang.org/

Please get pumped and put the dates in your calendars.

And stay tuned for details about how technically the conference will work.

Thanks everyone!

<3

Jay

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

On Fri, Jun 5, 2020 at 7:25 PM Jay McCarthy  wrote:
>
> In October 2020, we'll be holding a virtual RacketCon, rather than an
> in-person meeting as usual. We hope to get back to normal in 2021. We
> have not worked out the exact dates and details, but have a few
> parameters.
>
> We're thinking about following PLDI, where the general model is to
> have pre-recorded talks, which I would help presenters prepare,
> followed by live Q with an MC relaying questions from Slack. We'd
> hope to have the usual State of Racket presentation from Matthew,
> which would lead into a town hall Q/comment session with members of
> the Racket team.
>
> The main details we need to work out now are exactly which and how
> many days to run it and in what time slots and in what time zones. I
> would greatly appreciate any comments you have in response to this
> form:
>
> https://forms.gle/cYNNY9XhmEoUBBe19
>
> Thank you!
>
> Jay
>
> --
> Jay McCarthy
> Associate Professor @ CS @ UMass Lowell
> http://jeapostrophe.github.io
> Vincit qui se vincit.

-- 
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/CAJYbDa%3DOuiuzM2oY4_4sYkeZiH%2BhriLSz4zZ6PC94pwhc8bGZA%40mail.gmail.com.


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

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

Jay

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


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

>
> Hi All,
>
> I'm looking into using Racket structs to represent abstract syntax trees.
> I've gotten as far as defining gen:custom-write properties, but have not
> yet figured out how to control indenting. Also, I'm not sure I'm just
> calling
> write-string, write, and newline in my gen:custom-write methods, which I
> suspect is not exactly correct.
>
> Are there some good up-to-date examples of this that I could look at?
>
> Thanks,
> Jeremy
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/550ad1e1-90af-4f6d-8f31-57fccfe2d25an%40googlegroups.com
> <https://groups.google.com/d/msgid/racket-users/550ad1e1-90af-4f6d-8f31-57fccfe2d25an%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAJYbDakp%3DQkgOmEaSMODKB6sbxF7MFRBDcMgfajscxJvLa29zw%40mail.gmail.com.


[racket-users] (chaperone RacketCon) 2020

2020-06-05 Thread Jay McCarthy
In October 2020, we'll be holding a virtual RacketCon, rather than an
in-person meeting as usual. We hope to get back to normal in 2021. We
have not worked out the exact dates and details, but have a few
parameters.

We're thinking about following PLDI, where the general model is to
have pre-recorded talks, which I would help presenters prepare,
followed by live Q with an MC relaying questions from Slack. We'd
hope to have the usual State of Racket presentation from Matthew,
which would lead into a town hall Q/comment session with members of
the Racket team.

The main details we need to work out now are exactly which and how
many days to run it and in what time slots and in what time zones. I
would greatly appreciate any comments you have in response to this
form:

https://forms.gle/cYNNY9XhmEoUBBe19

Thank you!

Jay

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

-- 
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/CAJYbDamx86%3DMrgekSvarLv5foA9JD56n02Evu7o0Wq8vShgBcw%40mail.gmail.com.


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

2020-04-30 Thread Jay McCarthy
Hi Sage,

Racket has a very high standard of backwards compatibility where we
strive for programs to work continuously after many many years. In
most cases, we've been able to live up to the standard with the core
pieces of Racket. I can think of only a few times where we broke
compatibility and they were really traumatic and I think we learned a
lot from them about what compatibility really means.

The package system reflects this ethos. As you know, you can give a
dependency a lower-bound, but not an upper-bound, because we have
always been fairly loose with adding functionality (although it is
technical backwards incompatible), but not removing functionality. If
you need to break old programs, then you need to make a new logical
package, i.e. choose a new name, perhaps by adding a number to your
old name.

If you need to remove functionality or otherwise break old code, then
you are not really working on the same package anymore, but a new
product with similar functionality. In the history of Racket, you can
see this with the change from `(module _ mzscheme ...)` to `#lang
scheme` to `#lang racket` and in the change from `(require mred)` to
`(require scheme/gui)` to `(require racket/gui)`. These are NOT just
advertising changes because of new names; instead, the name was a
result of the need to add or remove functionality, while still
allowing all old programs to continue working.

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.

If you do so, and if your users need to pin themselves to particular
versions there are broadly two techniques. First, you can create your
own package catalog. Most users typically use two catalogs: the "big"
one on pkgs.racket-lang.org and another "small" one for your
particular release, where the core racket packages are pinned to
particular versions. When we were designing the package system, we
imagined that organizations would maintain their own catalogs of
audited versions of packages so they would not be surprised by any
automatic updates. Second, you can change your package source to pin
to a particular git revision/tag. This might be particularly useful if
a package relies on erroneous behavior of some package that was
otherwise fixed.

Jay

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

On Wed, Apr 29, 2020 at 12:47 PM Sage Gerard  wrote:
>
> April 9th in the #general Slack channel taught me that there was no clean way 
> to
> release a breaking change in a package. I'm open to working on version pinning
> support in raco pkg provided that a maintainer can walk me through some code.
>
> In the meantime, as much as I appreciate the efforts made in the current 
> system,
> I'm considering stopping my contributions to the package catalog until 
> further notice.
> I'm open to submitting packages if I am confident in their longevity, but I 
> don't want
> to end up in the position I've been in for the last few weeks when planning a 
> release.
> That position being an inability to release an edition that is not in some 
> way "aware"
> of a prior edition. In my view, changing the package/collection name is an
> example of that problem, not a solution to it.
>
> I'm considering asking my users to specify different package sources in their 
> info.rkt
> files when dealing with my work. Before I commit to that decision, I wanted 
> to tap into
> those of you who have already been here. How have you handled breaking changes
> for your projects? How have you communicated with your users to make sure they
> were adequately prepared? Am I being too black-and-white about this?
>
> ~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/3tKIr3GrU9Jnl7V-5yzb52OL3mjt8XNe9F_Qv9HDKwy8xC4j9lQo2e5eGSle4ZFHAee_FiGVhr15lXoovUE6yqoARP-ZNi3kXXz8ETXdufg%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/CAJYbDa%3Dg7xUiAG3ghR1AKRXneUVcY7Q6A4snMiNjNEC12O2P%2Bg%40mail.gmail.com.


Re: [racket-users] [re: opengl] Is this known Racket syntax?

2020-04-10 Thread Jay McCarthy
This comes from _fun, which define-gl expands to,

https://docs.racket-lang.org/foreign/foreign_procedures.html#%28form._%28%28lib._ffi%2Funsafe..rkt%29.__fun%29%29

The first -> is a type spec for the C function's return type and the
second -> is the output expression that is what the Racket wrapper
will return.

Jay

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

On Fri, Apr 10, 2020 at 10:02 AM Hendrik Boom  wrote:
>
> I'm building the new opengl binding for Racket, and keep running
> into surprises.
>
> Most of them are straightforward, but tedious, but I run into
> something strange.  It's a piece of syntax in the original
> (presumably) corrent, but obsolete, binding -- specifically,
>  a strange type.
>
> I thought I should ask before blundering through with it.
>
> Here's the definition for glAreProgramsResidentNV as present in
> the existing binding:
>
>
> (define-gl glAreProgramsResidentNV 2 ((n : _int32) (programs : (_u32vector 
> i)) (residences : (_vector o _bool n)) -> (result : _bool) -> (values result 
> residences)) (->> exact-integer? u32vector? (values boolean? (vectorof 
> boolean?))) check-gl-error)
>
>
> Now normally the define-gl macro seems to take
> a number,
> a type of the function (containing names for the parameters
> in the style of typed Racket's lambda arguments), and
> another type to put in the documentation.
>
> Now the type of the function here is
> ((n : _int32) (programs : (_u32vector i)) (residences : (_vector o _bool n)) 
> -> (result : _bool) -> (values result residences))
>
> An ordinary enough looking type except that -> occurs twice.
>
> **: Is this a known Racket construct?
>
> Or is it something peculiar to define-gl, which I'll just have
> to figure out as I build the new opengl binding.  It's presumably
> related to the fact that the 'residences' parameter is for output.
>
> -- hendrik
>
>
> In case anyone is interested, here are the relevant
> machine-readable bits from the nes and the old Khronos API specifications
>
>
> The xml specfile entry for this is:
>
> 
> GLboolean 
> glAreProgramsResidentNV
> GLsizei n
> const GLuint 
> *programs
> GLboolean 
> *residences
> 
> 
>
>
> And here's the old specfile entry from the old Khronos opengl standard:
>
> AreProgramsResidentNV(n, programs, residences)
> return  Boolean
> param   n   SizeI in value
> param   programsUInt32 in array [n]
> param   residences  Boolean out array [n]
> categoryNV_vertex_program
> dlflags notlistable
> version 1.2
> extension   soft WINSOFT NV10
> glxflagsignore
> glxvendorpriv   1293
> offset  578
>
>
> --
> 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/20200410140217.b4e5xizymwunvyu6%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/CAJYbDakT1AXhd7zBK%2BHQ%2B5-z6RnkoHj__xxyGAD6vDXt21mWrA%40mail.gmail.com.


Re: [racket-users] Best way to say "terminate unless received by X time"

2020-03-24 Thread Jay McCarthy
You can start a second thread that monitors the condition as well as a
timer; if the timer goes off first, then you kill the first thread; if
the condition happens first, then it continues. If you don't want the
second thread to have to monitor the condition, then the first thread
should tell the second thread that everything is okay, such as by
setting a semaphore.

Like this:

```
#lang racket/base

(define (kill-unless-sema-after-secs t sema secs)
  (thread
   (λ ()
 (sync sema
   (handle-evt (alarm-evt (+ (current-inexact-milliseconds)
 (* 1000 secs)))
   (λ _
 (kill-thread t)))

(module+ main
  (define t
(thread
 (thunk
   (let loop ()
 (define sema (make-semaphore))
 (kill-unless-sema-after-secs t sema secs)
 (define-values (len shost sport)
   (udp-receive! socket buffer))
 (semaphore-post sema)
 ;; xxx do stuff
 (loop))
```

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

On Tue, Mar 24, 2020 at 4:03 PM David Storrs  wrote:
>
> I've got this code:
>
> (thread
>   (thunk
> (let loop ()
>   (define-values (len shost sport) (udp-receive! socket buffer))
>   ...do stuff with the received message...
>  (loop
>
> I'd like to be able to say "If you haven't received a message in X time, kill 
> the thread".  I'm not sure how to enact that; sync/timeout won't do it since 
> the thread won't return.  I've thought of weird signaling systems using 
> channels or set! on some external value or etc, but they are all terrible.
>
> What's the right way to do this?
>
> --
> 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/CAE8gKocoTTN0VfOToioMq3xK_0ysqAQVHmZ%2BmiFS9iutzY0sxQ%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/CAJYbDam%3D7teWJun3zg3c4MBtV4Ew%2Bgv6-Zj9xE7LTBew92u9RQ%40mail.gmail.com.


Re: [racket-users] using plai/gc2/{collector,mutator} in one file

2020-03-19 Thread Jay McCarthy
The plai languages pre-date submodules, so you're right that they were not
tested or designed to support them. It might be possible, but I am
skeptical about it being a quick fix. The problem might just be that they
are built on `scheme` but if they were built on `racket` everything would
just work.

Jay

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


On Wed, Mar 18, 2020 at 8:33 PM David Bremner  wrote:

>
> As part of an effort to use plai/gc2 with the racket handin server
> (never having really successfully used the multiple file stuff), I've
> been trying (and failing) to use modules in one file for the collector
> and mutator.
>
> Attached is the simplest possible example I could cook up using sample
> code from the web. In racket 7.6 I get a complaint about 'submod: not a
> require sub-form ; in: (submod ".." null-gc)'. That doesn't seem right
> to me, but I guess maybe allocator-setup was never tested with a
> submodule path. Any workaround/correction is welcome.
>
> --
> 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/87a74ddvyp.fsf%40tethera.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/CAJYbDa%3DiNs5OR1kAWz8uYg_DsQfw9jjPtEFk0eJ0Rcz8sTukxA%40mail.gmail.com.


Re: [racket-users] Implications of stateless servlets & how/whether to avoid them

2020-02-20 Thread Jay McCarthy
I assume it is not necessary to be totally accurate, but it is good to when
you can, because of the Web principle of accepting broad input and
producing specific output. I don't know of any existing program (like a
proxy or something) that would fail without an accurate length, but it
wouldn't surprise me if there was one.

Jay

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


On Thu, Feb 20, 2020 at 11:17 AM Brian Adkins  wrote:

> On Monday, December 3, 2018 at 10:49:40 AM UTC-5, Jay McCarthy wrote:
>>
>> > I don't know if the Racket web server (or related libraries) currently
>> provide a way to stream data in the response, but that is something I'll
>> definitely need relatively soon (primarily for streaming large CSV/JSON
>> files). If it doesn't exist, I don't mind writing it, but I also don't want
>> to begin with an approach now that might make adding that capability more
>> difficult later. From my brief research, given the output field of the
>> response struct is a lambda, I think I can stream using that (i.e. return a
>> lambda in the response immediately that begins writing the data as it
>> retrieves it) - hopefully the infrastructure doesn't buffer the entire
>> output. Other than something like that, I'm happy to work mostly at the
>> level of functions from requests to responses.
>>
>> The reason why responses have the lambda rather than a byte string is
>> specifically for streaming like you want. Make sure you specify the
>> correct response size in the headers.
>
>
> Jay, are you sure it's necessary to specify the correct response size in
> the headers? This would be extremely inconvenient in a streaming response
> scenario. I looked at some similar code in a Rails project, and it appears
> I'm only setting Last-Modified, Content-Disposition and Content-Type
> headers.
>
> Yes, I know this is an old thread, but I'm just now having to stream some
> CSV files from the web app :)
>
> --
> 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/995deb39-16f7-432e-8931-3bbae4d86bb7%40googlegroups.com
> <https://groups.google.com/d/msgid/racket-users/995deb39-16f7-432e-8931-3bbae4d86bb7%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAJYbDa%3Dr%2BqARXUCh90Fw1b5c7XqGCyenZcO--t02vK6Sae7wLA%40mail.gmail.com.


Re: [racket-users] Proxying websockets via web-server

2020-01-14 Thread Jay McCarthy
Hi Dominik,

The cited package is definitely what you want, but you'll have to
crack open the source code a little bit to access the underlying
pieces. It currently uses all of the existing `web-server` libraries
and sets up a dispatcher chain for Websockets. You can see the entry
point here --- 
https://github.com/tonyg/racket-rfc6455/blob/master/net/rfc6455/server.rkt#L46
and 
https://github.com/tonyg/racket-rfc6455/blob/master/net/rfc6455/dispatcher.rkt#L9
--- so I think you just need to customize those things and attach them
to your own dispatcher chain.

Jay

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

On Sun, Jan 12, 2020 at 11:18 AM Dominik Pantůček
 wrote:
>
> Sigh... I forgot to reply to the list... Here we go:
>
> I want a single HTTP server like serve/servlet (or similar) that handles
> all requests by the standard dispatcher/c logic - ideally using
> dispatch/servlet with dispatch-case to specify the mapping. And for one
> specific URL path "/sockjs-node", I need it to be able to do the
> websocket HTTP 101 protocol switch.
>
> The React.js application in the browser just communicates using HTTP and
> if you run its minimal node.js server with "npm start" its HTTP
> implementation contains the selective websocket URL path and it works. I
> just need a way to proxy this, as my Racket backend is the HTTP server.
> For static data I produce response/full with that data, for API calls,
> it is response/jsexpr and for this websocket endpoint, I would like to
> run copy-port and be done with it - after the protocol switch, that is.
>
> From what I read about rfc6455 package, it cannot be used with the
> web-server package. I'll dive into the source later today.
>
> Actually I can live without that, yet I was curious as it provides a
> convenient way to reload the frontend after source changes in its code
> (that is the Javascript part). For production builds, a plain
> serve/servlet does all the job required.
>
>
> Dominik
>
> On 11. 01. 20 3:18, Jay McCarthy wrote:
> > I don't completely understand what you want to do. Is there a reason
> > you can't use the WebSocket implementation ---
> > https://docs.racket-lang.org/rfc6455/index.html --- and then use
> > normal inter-Racket communication like channels and stuff to work with
> > the rest of your Web application?
> >
> > Jay
> >
> > --
> > Jay McCarthy
> > Associate Professor @ CS @ UMass Lowell
> > http://jeapostrophe.github.io
> > Vincit qui se vincit.
> >
> > On Thu, Jan 9, 2020 at 5:23 PM Dominik Pantůček
> >  wrote:
> >>
> >> Hello everyone,
> >>
> >> I am working on an application that uses React.js[1] for front-end and
> >> Racket as HTTP back-end server.
> >>
> >> For production builds, the Javascript part is compiled using "npm build"
> >> which generates a directory full of HTML and Javascript files which are
> >> then included in the Racket application during syntax stage as an
> >> immutable hash. For development builds, the Racket application runs "npm
> >> start" in the front-end source directory and proxies all non-backend
> >> requests to the managed node.js server.
> >>
> >> When run in the development setup (that is with the node.js secondary
> >> HTTP server), the proxying using serve/servlet and simple dispatch-case
> >> works like a charm - each servlet uses http-sendrecv to get the data
> >> from the secondary HTTP server and returns it as appropriate response body.
> >>
> >> But the reason for this setup is that React.js can automatically reload
> >> the webpage, if any of the source files change. To do this trick, it
> >> uses an url "/sockjs-node". The browser sends GET request for this
> >> resource and the node.js server responds with "HTTP/1.1 101 Switching
> >> Protocols" like in [2].
> >>
> >> Apparently, to make this work, I need to establish a bi-directional
> >> connection after the 101 response code. This is impossible with
> >> serve/servlet. I have done some experiments with plain (serve #:dispatch
> >> ...) and just cannot make it work all at once. With connection-i-port
> >> and connection-o-port it should be (relatively) easy to implement. But
> >> the documentation is virtually nonexistent and browsing the
> >> web-server/private/ sources is a bit tricky if I do not know what I am
> >> looking for.
> >>
> >> If anyone can give me a hint how a proper setup for websocket
> >> implementation s

Re: [racket-users] Proxying websockets via web-server

2020-01-14 Thread Jay McCarthy
Thanks for noticing that problem with the format string, Eli.

As far as examples, there are some in the github repository ---
https://github.com/tonyg/racket-rfc6455/tree/master/net/rfc6455/examples

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

On Sat, Jan 11, 2020 at 11:17 PM Eli Barzilay  wrote:
>
> On Fri, Jan 10, 2020 at 9:18 PM Jay McCarthy  wrote:
> >
> > I don't completely understand what you want to do. Is there a reason
> > you can't use the WebSocket implementation ---
> > https://docs.racket-lang.org/rfc6455/index.html --- and then use
> > normal inter-Racket communication like channels and stuff to work with
> > the rest of your Web application?
>
> It would be nice if the documentation for that would have some
> examples, but after playing with it for a bit it looks like it's
> broken, possibly because I don't use it properly.  I keep getting
> errors that look like "read-request: malformed request ..." with
> binary goo in the error message, which usually displayed like random
> unicode, sometimes it breaks the terminal due to weird escape
> sequences.  Even if I'm not using it properly, such errors shouldn't
> happen.
>
> And as a side note, one of the errors I saw was:
>
>  exception raised by error display handler: format: ill-formed pattern string
>explanation: tag `~l' not allowed
>pattern string: "read-request: malformed request
> ...junk...~l...more..."; original exception raised: read-request: ...
>
> which looks like a bad error re-raising in the web server code.  A
> quick grep finds at least one suspicious line which erroneously uses a
> random string as a format string:
>
> (with-handlers ([exn:fail? (lambda (exn) (network-error
> 'output-file (exn-message exn)))]) ...
>
> --
>((x=>x(x))(x=>x(x)))  Eli Barzilay:
>http://barzilay.org/  Maze is Life!

-- 
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/CAJYbDa%3DvL%3D8EZfKdAPWFV8vmxwGOL7TCaHo8Ofpx1XYja8ZRRg%40mail.gmail.com.


Re: [racket-users] Proxying websockets via web-server

2020-01-10 Thread Jay McCarthy
I don't completely understand what you want to do. Is there a reason
you can't use the WebSocket implementation ---
https://docs.racket-lang.org/rfc6455/index.html --- and then use
normal inter-Racket communication like channels and stuff to work with
the rest of your Web application?

Jay

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

On Thu, Jan 9, 2020 at 5:23 PM Dominik Pantůček
 wrote:
>
> Hello everyone,
>
> I am working on an application that uses React.js[1] for front-end and
> Racket as HTTP back-end server.
>
> For production builds, the Javascript part is compiled using "npm build"
> which generates a directory full of HTML and Javascript files which are
> then included in the Racket application during syntax stage as an
> immutable hash. For development builds, the Racket application runs "npm
> start" in the front-end source directory and proxies all non-backend
> requests to the managed node.js server.
>
> When run in the development setup (that is with the node.js secondary
> HTTP server), the proxying using serve/servlet and simple dispatch-case
> works like a charm - each servlet uses http-sendrecv to get the data
> from the secondary HTTP server and returns it as appropriate response body.
>
> But the reason for this setup is that React.js can automatically reload
> the webpage, if any of the source files change. To do this trick, it
> uses an url "/sockjs-node". The browser sends GET request for this
> resource and the node.js server responds with "HTTP/1.1 101 Switching
> Protocols" like in [2].
>
> Apparently, to make this work, I need to establish a bi-directional
> connection after the 101 response code. This is impossible with
> serve/servlet. I have done some experiments with plain (serve #:dispatch
> ...) and just cannot make it work all at once. With connection-i-port
> and connection-o-port it should be (relatively) easy to implement. But
> the documentation is virtually nonexistent and browsing the
> web-server/private/ sources is a bit tricky if I do not know what I am
> looking for.
>
> If anyone can give me a hint how a proper setup for websocket
> implementation should look like, I would really appreciate it. Of
> course, I also want to use the dispatch-case with plain requests as it
> automates most of the real work I need to perform there.
>
>
>
> Cheers,
> Dominik
>
> [1] https://reactjs.org/
> [2] https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake
>
> --
> 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/a3834699-4ed6-f337-1409-9f175636c087%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/CAJYbDa%3DNrgMa%2BDzNz0uGL%3Daq2jVrb4rLuNSQibezwuxHYH%3D9kA%40mail.gmail.com.


Re: [racket-users] How to prepare and present new pict3d internal documentation?

2020-01-01 Thread Jay McCarthy
I don't think there is precedent in Racket for stuff like this. There
are quite a few programs that have really long comments at their start
that explain how they work and for the Web server, there's a separate
section of the docs that have a bunch of random sub-pieces documented
--- https://docs.racket-lang.org/web-server-internal/private.html ---
I think if I were doing this today, I would have made a bunch of
little packages. It would not surprise me if parts of pict3d could be
other packages and/or independently useful and it would make sense to
document them that way.

Jay

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

On Tue, Dec 31, 2019 at 7:30 AM Hendrik Boom  wrote:
>
> How to prepare and present new pict3d internal documentation?
>
> I'm busy working on new internal documentation of pict3d.
> I'd like some advice on how to prepare and present the resulting document 
> (which isn't even a draft yet).
>
> Pict3D's various components look to be useful on their own,
> and I'd like to use texture mapping with it.  This requires some level of 
> understanding of it internals.
>
> At present there seems to be no such internal documentation.
> (or is there an ancient thesis or lost internal project report or some thing 
> like that?  If so I haven't foud it.)
>
> What I have now is a file of ragged notes on pict3d.
>
> It constitutes a kind of diary of my questions and discoveries as I work my 
> way into it, a few hours at a time every week or two.
>
> you can see it on github:
> https://github.com/hendrikboom3/rackettown/blob/master/notes.pict3d
>
> If you bother to look at them it's obvious that they won't constitute the 
> internal documentation I' looking for.
>
> Before I actually start producing definitive documentation, I'd like to have 
> a few answers.
>
> In what form should I present the internal API?
>
> Of course, a scribble document, and there are conventions for that.
>
> (1) Should it be a separate document from the existing pict3d user 
> documentation?
>
> (2) Should it be part of the source code for pict3d?  (which would presumably 
> result in a pull request someday)  That might well make the pict3d source 
> code itself somewhat more comprehensible, at least while I'm trying to read 
> it. But I'd need a mechanism to extract comments and other information from 
> the source code and assemble it into a readable document.
>
> Or should it be a separate file within the pict3d source code?
>
> Or should it have its own source repository?
>
> (3)  Are there any established conventions for API documentation in Racket 
> source code?
>
> (3a) I've found there is no shortage of hard-to-use API documentations 
> generated automatically from source code.  But it's possible to do better.  
> The Trestle Reference Manual ( 
> http://www.opencm3.net/doc/src_reports/src-068.pdf ) is an example of it done 
> right.  I'd like to do it right myself.
>
>
> This is an open project.  Advice, critique, proposed content, and useful 
> information are all welcome.
>
> Especially answers to relevant questions I haven't thought of yet!
>
> -- 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/20191231123027.lcspvrc6nc5sdlgr%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/CAJYbDak%2BQr%3DGc4CAqepb4rfJ0DF7eHPhWKtvZRWzRq1%2B_0-WEg%40mail.gmail.com.


Re: [racket-users] xml library clarification - "" symbol parsing

2019-11-21 Thread Jay McCarthy
Hi Kira,

I think this is consistent with how XML is defined. There is a
sequence of character data inside of tags. Character data is
represented by strings in the `xml` library. And there is a sequence
of those.

Jay

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

On Thu, Nov 21, 2019 at 12:51 PM Kira  wrote:
>
> I have a few questions.
>
> 1. Consider XML like this:
> testtest qoute
>
>
> (string->xexpr "testtest 
> qoute")
> Will produce this:
> '(ROOT () (A () (B1 () "test") (B2 () "\"" "test qoute" "\"")))
>
> The problem is  is parsed as separate entity. You can see that they 
> added to list of element content as separate strings "\"" "test qoute" "\""
>
> And, (read-xml) do the same thing.
> And they somehow converted back to text in rigth maner.
>
> I tested sxml. And it is producer rigth (for me) output.
>
> I feel that this is wrong behavior. Because this  symbols is direct 
> part of one and whole element content. And must be read as "\"test qoute\"".
>
> Can please someone explain reasoning under such behaivor, and can we change 
> it? Perhaps it is important for some other racket libs?
> It is just totally contrintuitive for me. And creating a huge problems with 
> even simple XML parsing. (I am basically battling XML lib all day already to 
> do most simple tasks)
>
> --
> 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/b5047678-0d11-4d00-a1e9-1579ad745e6b%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/CAJYbDa%3DO%2B6ugXX9supb0P4GFqMz9xhoCisiiH6RSmJ2L4v3xtA%40mail.gmail.com.


Re: [racket-users] current source repository for pict3d

2019-11-13 Thread Jay McCarthy
The current repository is my fork:

http://github.com/jeapostrophe/pict3d

You can see that by consulting the page on the package server:

https://pkgs.racket-lang.org/package/pict3d

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

On Wed, Nov 13, 2019 at 1:47 PM Hendrik Boom  wrote:
>
> Where is the current source code for pict3d code and documentation?
>
> I have found https://github.com/ntoronto/pict3d but that hasn't been
> maintained in years, and there are a 7 outstanding pull requests, some
> of which appear to fix problems and date bace to 2017.
>
> Presumably there's a pict3d repository somewhere in Racket's codebase
> that corresponds to what's being distributed now.
>
> -- 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/20191113184727.tpdfqljyvcmtmoe7%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/CAJYbDamq67yspE1Lv7c%2BYtaiQYiepchbVL-JAPipK1XigohU5A%40mail.gmail.com.


Re: [racket-users] Evaluating to get the output with a specific lang

2019-11-10 Thread Jay McCarthy
I feel like I might not understand what you want, but it feels like
you just want to use `make-module-evaluator` from `racket/sandbox`:

```
#lang racket/base
(require racket/sandbox)

(define (read-script s)
  (((make-module-evaluator s) 'script) 5))

(module+ test
  (read-script
   "#lang racket/base
(provide script)
(define (script x) (add1 x))")
  (read-script
   "#lang typed/racket/base
(provide script)
(: script (-> Number Number))
(define (script x) (add1 x))"))
```

You may want to set the `#:language` argument to control the language.
And you will also want to set `sandbox-namespace-specs` to link up
your internal data-structure providing modules so you can communicate.
But other than those two things, it should be pretty straightforward.
What is different about this than what you are trying to do?

Jay

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

On Sun, Nov 10, 2019 at 7:15 PM Christopher Lemmer Webber
 wrote:
>
> Hey Eric!  Thanks, I'll try to soak in this a bit tomorrow. :)
>
> Eric Griffis writes:
>
> > This works:
> >
> > 1. mkdir foo; cd foo; raco pkg install
> >
> > 2. create foo/main.rkt:
> >
> > ```
> > #lang racket/base
> >
> > (module reader racket/base
> >   (require racket/port)
> >   (provide (rename-out [foo-read read]
> >[foo-read-syntax read-syntax]))
> >   (define (foo-read port)
> > `(module ,(gensym 'foo) racket/base
> >(provide the-foo)
> >(define the-foo (let () ,@(port->list read port)
> >   (define (foo-read-syntax path port)
> > (datum->syntax #f (foo-read port
> > ```
> >
> > 3. In the REPL or another file, we can simulate the game's interaction with
> > the player's connection through an input port:
> >
> > ```
> > (define foo-source #< > #lang foo
> >
> > (define bar 1)
> >
> > (+ bar 2)
> > END
> >   )
> >
> > (define player-input (open-input-string foo-source))
> >
> > (define source
> >   (let ([define-mod (parameterize ([read-accept-reader #t])
> >   (read player-input))])
> > (define mod-name (cadr define-mod))
> > `(begin ,define-mod (let () (local-require (quote ,mod-name))
> > the-foo
> >
> > (println `(GOT ,(eval source (module->namespace 'racket/base
> > ```
> >
> > The value-extraction code is kind of messy, so you might want to stow it in
> > a `port-read-handler`, like this:
> >
> > ```
> > (port-read-handler
> >  player-input
> >  (let ([default-handler (port-read-handler player-input)])
> >(case-lambda
> >  [(in) (define original-handler (port-read-handler in))
> >(define define-mod
> >  (parameterize ([read-accept-reader #t])
> >(port-read-handler in default-handler)
> >(begin0 (read in) (port-read-handler in original-handler
> >(define mod-name `(quote ,(cadr define-mod)))
> >(eval `(begin ,define-mod (let () (local-require ,mod-name)
> > the-foo))
> >  (module->namespace 'racket/base))]
> >  [(in source) (datum->syntax #f (read in))])))
> >
> > (println `(GOT ,(read player-input)))
> > ```
> >
> > Eric
> >
> >
> >
> > On Sun, Nov 10, 2019 at 12:19 PM Christopher Lemmer Webber <
> > cweb...@dustycloud.org> wrote:
> >
> >> Hi Eric!  Thanks very much for the reply.
> >>
> >> Eric Griffis writes:
> >>
> >> >> It appears there must be; when I look at `build-program` in
> >> >> sandbox.rkt it also looks like it's wrapping things in a module
> >> >> structure... but I don't see how it then exports from that module or
> >> >> how the code evaluating it imports its export.  Or does it actually
> >> >> do so via an effect?  I see there are some channels involved
> >> >> (input-ch / result-ch) so maybe it's passing back the result through
> >> >> there, but I am having trouble figuring out how.
> >> >
> >> > Apologies for stating the obvious, but to get a value out of a module, we
> >> > `provide` it:
> >> >
> >> > In foo/main.rkt:
> >> >
> >> > ```
> >> > (define-syntax-rule (foo-module-begin form ... final-form)
> >> >   (#%module-begin (provide the-foo) form ... (define the-foo
> >> final-form)))
> >> >

Re: [racket-users] Parameters and dynamic-require

2019-11-10 Thread Jay McCarthy
When I run

```
#lang racket/load

(module p racket/base
  (define out (make-parameter 'original-value))
  (provide out))
(module a racket/base
  (require 'p)
  (displayln (list 'a (out)))
  (define a 43)
  (provide a))
(require 'p)
(displayln (list 'outer (out)))
(out "foo")
(displayln (dynamic-require ''a 'a))
```

I get

```
(outer original-value)
(a foo)
43
```

as expected

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

On Sun, Nov 10, 2019 at 10:37 AM Jens Axel Søgaard
 wrote:
>
> Hi All,
>
> How can I set a parameter used in a dynamically required module?
>
> Example:
> A parameter `out` is defined in a module p.
> Before requiring (dynamically) module a, we want to set the parameter.
>
> The attempt below fails.
>
> (module p racket/base (define out (make-parameter 'original-value)) 
> (provide out))
> (module a racket/base (require 'p) (displayln (list 'a (out))) (define a 
> 43) (provide a))
> (require 'p)
> (displayln (out))
> (out "foo")
> (dynamic-require ''a 'a)
>
> The output is:
> (a original-value)
> original-value
> 43
>
> I am hoping to see (a "foo").
>
> /Jens Axel
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CABefVgxbZ5Jo1Gee8PCEArHSTrT9TBqcvUCZJoKB0QV3duHEgw%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/CAJYbDamY0okPu%2B-SCZAkffn2Xy-2B-hb8nsDU9mwAvL87zr%3DHQ%40mail.gmail.com.


Re: [racket-users] Modeling a context-sensitive evaluation context with PLT Redex?

2019-11-09 Thread Jay McCarthy
That is an interesting idea. I want to emphasize this point again:

"remember that an evaluation context is just a way of describing more
succinctly what you could otherwise define by hand as a big,
complicated relation on individual terms."

There is nothing special about evaluation contexts. I think they are
beautiful, but they don't, for example, automatically come with a set
of free theorems, like monads. The best thing they have going for them
is that they decouple the specification of evaluation rules and where
those rules occur (i.e. there are no "congruence" rules in the
reduction relation.) But, a reduction system can always have extra
rules that don't use them, so you don't get anything "for free". It is
possible that the thing you want can't be done using contexts, but
that doesn't mean redex or even redex's reduction-relation is wrong
tool to use.

That said, I don't think the idea of a "first-class" context or
evaluation rule makes sense, because the whole point of a proof theory
is to have a fixed set of proof schemas which you can reason about. If
you want to take term data and turn that into new rule cases, then
you'll have to have a more general rule that inspects the term data
and acts on it. For example, if you wanted your term data to be able
to cause evaluation anywhere, then one technique would be to by
default have evaluation happen everywhere, but then the evaluation
rule will inspect the context to see if evaluation is enabled in any
specific case. I think that makes sense from an implementation
perspective too.

Maybe not useful, but I believe that delimited control was really made
by Matthias to solve the same problem as algebraic effects are solving
today. Read his papers again in that light and it may be helpful. I
have a series of blog posts from 2012 that attempt to explain this
perspective [1] through [2] and this is how my DOS package works [3].
DOS makes this really explicit because the state outside of the
handlers is specified as a monoid that combines the effects from each
of the contexts that can create effects.

Jay

1. https://jeapostrophe.github.io/2012-06-18-pipe-post.html
2. https://jeapostrophe.github.io/2012-07-12-cont-sys-post.html
3. https://docs.racket-lang.org/dos/index.html

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

On Sat, Nov 9, 2019 at 7:30 AM Alexis King  wrote:
>
> Hi Jay,
>
> I appreciate your pointers! However, I think either I didn’t make my question 
> clear enough, or I misunderstand your explanation (or perhaps some of both).
>
> What I am trying to model is, indeed, a form of delimited control. I have 
> already written a model that supports a couple classic control operators, 
> namely exception handling and nondeterminism, plus some of the simpler 
> algebraic operations from the algebraic effects literature such as mutable 
> state. However, this isn’t quite sufficient for what I’m trying to do, as 
> effect systems allow the programmer to define those kinds of control 
> operators using more general primitives in the host language.
>
> Here’s an example of what an effect definition and an effect handler might 
> look like in a hypothetical language that supports algebraic effect handlers:
>
>   effect Error e where
> throw :: e -> a
>
>   handleError :: (() ->{Error e} a) -> Either e a
>   handleError f =
> handle Error where
>   throw e _k = Left e
> in Right (f ())
>
> You can reasonably think of `effect` and `handle` in terms of delimited 
> control. Each `effect` declaration declares a new prompt tag, and each 
> operation of the effect aborts, passing its current continuation to the 
> prompt handler. Likewise, each `handle` declaration installs a new prompt 
> with the appropriate tag and handler. (In the above example, `throw` discards 
> the continuation and simply returns.)
>
> This interpretation works well enough for algebraic effects, but this makes 
> it impossible to support operations like `catch`, or `cut` (for some kind of 
> backtracking effect) forcing them to be handlers instead. This turns out to 
> cause trouble in practice., so some newer work handles so-called “scoped” 
> effects as well, which support “scoping” operations like `catch` and `cut`. I 
> have been working on an implementation of a scoped effect system in Haskell, 
> but I have found many edge cases where the behavior of current systems 
> produces nonsensical results given certain handler compositions.
>
> Fortunately, I have found that it is possible to produce a significantly more 
> predictable semantics for scoped effect handlers by viewing them as kind of 
> like “first class reduction rules.” A handler for an Error effect supporting 
> both `throw` and `catch` can be expressed u

Re: [racket-users] Evaluating to get the output with a specific lang

2019-11-09 Thread Jay McCarthy
Modules don't evaluate to values. They have effects and they have
exported symbols. If you want to observe the evaluation of your
language's module, you'll have to look at one of those two things.
Both are used by existing Racket languages and infrastructure: `raco
test` relies on test modules making effects on a global box that
counts how many tests ran and failed. `scribble` relies on inspecting
an export named `doc`. In either case, I think you want to make
`#%module-begin` capture the last expression and expose its value via
an effect or an export.

Jay

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

On Sat, Nov 9, 2019 at 9:54 AM Christopher Lemmer Webber
 wrote:
>
> (Caveat: I know the sandbox evaluator exists.  I'm trying to understand
> how to do this without it, to understand the evaluation machinery for
> something.)
>
> Let's say I write "#lang foo".  For whatever reason, I have programs
> that are coming in from users that are not necessarily being saved
> to a file on disk... they may be coming from a GUI, read over the
> network, etc etc.  The only important thing is that at the end of the
> program, the last expression returns some value, and I want access to
> that value.  Simplest example, let's say we have the following program
>
> ```
>   #lang foo
>
>   (define bar 1)
>
>   (+ bar 2)
> ```
>
> I'd like to read this in and evaluate it, so presumably I'd want to get
> 3 returned.
>
> I've tried to figure out how to do this from trivial examples but I'm
> not having success.  I can see that I can read in a module:
>
> ```
> racket-sandbox.rkt> (parameterize ([read-accept-reader #t])
>   (call-with-input-string "#lang racket/base
> (+ 1 2)"
> (lambda (ip)
>   (read-syntax 'foo ip
> # 2)))>
> ```
>
> Cool, ok.
>
> But when I pass this module-wrapped structure to eval, the result is void.
>
> What should I do?  Help appreciated!
>
> --
> 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/8736exhzh8.fsf%40dustycloud.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/CAJYbDak7zwYp8gCW2zA%2B3hNGLLqr3tjRks7bO47X0st94s0Hiw%40mail.gmail.com.


Re: [racket-users] Modeling a context-sensitive evaluation context with PLT Redex?

2019-11-09 Thread Jay McCarthy
First, any inductive definition could be defined with
`define-judgment-form` (although derivations will only be discoverable
if you can give a mode spec.) If the semantics you're talking about
can't be written as an inductive definition, then it probably doesn't
make any sense.

Second, remember that an evaluation context is just a way of
describing more succinctly what you could otherwise define by hand as
a big, complicated relation on individual terms. (The beginning of
SEwPR explains this very well.) I feel like you'll get something from
thinking about existing semantics that structure the context in
different ways. For example, in "boring" lambda calculus, rules are
always of the form "E [ e ] -> E [ e' ]". But, in the traditional way
to explain exception-handling, you have a reduction rule like "E [ try
F [ throw v_x ] with catch v_h ] => "E [ v_h v_x ]" where you've
structured the context (F is "catch"-less contexts.) Chapter 8 of
SEwPR [1] covers this kind of thing. The delimited control example has
more complicated things like this too [2] but it might be too
complicated to understand just this piece of it. Another example to
look at is the context-based semantics of call-by-need. Stephen's ESOP
2012 paper [3] is a great place to look because it talks about a
standard old way and a clever new way, and is very readable, the key
is a rule like: "(\x. E[x]) v -> (\x. E[v]) v" where the terms in the
reduction relation don't use contexts only on the outside.

I don't really understand what you're trying to do, but it may be
possible to have a LHSes like

PhiContext [ GammaContext [ (gamma f v ExprContext [ (f e) ]) ] ]

to get what you want

Jay

1. https://redex.racket-lang.org/sewpr-toc.html
2. 
https://github.com/racket/redex/tree/master/redex-examples/redex/examples/delim-cont
3. http://www.ccs.neu.edu/home/stchang/pubs/Chang-Felleisen-ESOP2012.pdf

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


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


On Sat, Nov 9, 2019 at 4:10 AM Alexis King  wrote:
>
> Hello,
>
> I am trying to model a (not quite algebraic) effect system in PLT Redex, but 
> I’m struggling to encode my evaluation contexts into Redex’s pattern 
> language. My question is best explained via example, so I’ll start with a 
> bog-standard call-by-value lambda calculus:
>
> (define-language lam
>   [v ::= boolean (λ x e)]
>   [e ::= x v (e e) (if e e e)]
>   [E ::= hole (E e) (v E) (if E e e)]
>   [x ::= variable-not-otherwise-mentioned]
>   #:binding-forms
>   (λ x e #:refers-to x))
>
> My reduction relation for lam is the usual one. Next, I define an extended 
> language:
>
> (define-extended-language eff lam
>   [e ::=  (ψ x e) (γ (x p ...) e) (x e ...)]
>   [E ::=  (ψ x E) (γ (x p ...) E)]
>   [p ::= :v :e :E]
>   #:binding-forms
>   (ψ x e #:refers-to x))
>
> This is a severe simplification of the actual language I’m trying to model, 
> but it’s enough to illustrate my problem: the definition for E I’ve given 
> above is inadequate. What I actually want is to have some kind of 
> “dynamic”/“context-sensitive” evaluation context, where γ can introduce 
> scoped evaluation rules for identifiers bound by ψ.
>
> To give an example, if I have the expression
>
> (ψ f
>   (γ (f :E :e)
> (f (if #t #f #t) (if #t #f #t
>
> I would like it to reduce to
>
> (ψ f
>   (γ (f :E :e)
> (f #f (if #t #f #t
>
> because (γ (f :E :e) e_1) effectively extends E with a new production rule (f 
> E e) inside e_1, allowing reduction to recur into the first argument to f, 
> but not the second.
>
> If I were to define these rules on pen and paper, without using Redex, my 
> instinct would be to create some kind of “parameterized” evaluation context. 
> That is, I would define something like this:
>
> r ::= (x p ...)
>
> (E r ...) ::=
>   hole ((E r ...) e) (v (E r ...)) (if (E r ...) e e)
>   (ψ x (E r ...)) (γ r_0 (E r_0 r ...))
>   (E-r r r ...) ...
>
> (E-r (x p ...) r ...) ::= (x (E-p p r ...) ...)
>
> (E-p :v _ ...) ::= v
> (E-p :e _ ...) ::= e
> (E-p :E r ...) ::= (E r ...)
>
> Though a little complicated to define, I think decomposition using these 
> evaluation contexts is still entirely syntax-directed (assuming the r 
> arguments are only used as inputs; i.e. E, E-r, and E-p are “metapatterns”). 
> Proving anything in this system seems like it could be a massive headache, 
> but it’s much too soon for me to be worrying about that — I just want a 
> super-flexible model I can th

Re: [racket-users] What's the best way to do these syntax transforms?

2019-11-08 Thread Jay McCarthy
On Fri, Nov 8, 2019 at 9:51 AM Christopher Lemmer Webber <
cweb...@dustycloud.org> wrote:

> I have a need to do two things in a #lang:
>
>  - Most importantly, make all strings that appear in the source code
>immutable
>

Make #%datum turn literal strings `s` into `(string->immutable-string s)`


>  - Second and not as urgent, I'd like to add a "dot" notation, so that
>(foo.bar 1 2 3) expands into (foo 'bar 1 2 3)
>

Turn on `read-cdot` and then make the `#%dot` macro put a quote on the RHS
and have #%app notice a #%dot and unwrap it

Jay


> It seems to me that both of these needs are similar.  I can imagine how
> to do both by thinking of the syntax tree like a list structure and
> rewrite via recursive descent.  I guess I would re-append the src
> locations to the new structure.  This seems doable.
>
> But is it the best way?  I'm guessing maybe there's a more racket'y way
> but I'm unsure.
>


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

-- 
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/CAJYbDanKjP3D6eyJ8cKbmLNAh48S6nJKno4hmEYwp1tHsjnRMw%40mail.gmail.com.


Re: [racket-users] How to efficiently simulate a video display

2019-10-28 Thread Jay McCarthy
You really do not want to be creating bitmap structures or converting
anything like that. You want to directly manipulate a byte array to
store the image and then upload it to the GPU with glTexImage2D every
frame. You then want to just draw a fullscreen quad. It is practically
the simplest shader you can think of. In mode-lambda, my `std` shader
is what you want:

https://github.com/jeapostrophe/mode-lambda/blob/master/mode-lambda/backend/gl/std.fragment.glsl
https://github.com/jeapostrophe/mode-lambda/blob/master/mode-lambda/backend/gl/std.vertex.glsl

And the rendering code would be very simple, like:

https://github.com/jeapostrophe/mode-lambda/blob/master/mode-lambda/backend/gl.rkt#L253-L288

If you Google, "OpenGL draw fullscreen quad", you'll find a bunch of
tutorials on doing this.

Jay

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

On Tue, Oct 22, 2019 at 1:33 PM wanderley.guimar...@gmail.com
 wrote:
>
> Thanks for the quick response.  Can you elaborate a bit more?  I've
> never worked with OpenGL before, so I don't know exactly how to start
> with that.
>
> I found that I can use the mapped screen directly to generate a
> monochrome bitbmap.
>
>(make-monochrome-bitmap 512 256
>  (apply bytes (map (lambda (x) (modulo x 255)) (range (* 512 256)
>
> With that I can get rid of the transformation bits->argb-bytes->pict->bitmap.
>
> I saw gl-context but I didn't figure out how to use it the image that
> I send to big-bang.
>
> Thanks,
> Wanderley
>
> On Tue, Oct 22, 2019 at 8:58 AM Jay McCarthy  wrote:
> >
> > I would use a really simple OpenGL draw call that just draws a
> > rectangle and update the texture contents with the screen bits.
> >
> > --
> > Jay McCarthy
> > Associate Professor @ CS @ UMass Lowell
> > http://jeapostrophe.github.io
> > Vincit qui se vincit.
> >
> > On Tue, Oct 22, 2019 at 6:54 PM wanderley.guimar...@gmail.com
> >  wrote:
> > >
> > > Hi folks,
> > >
> > > I decided to write a computer simulator (16-bit machine as the one
> > > built in nand2tetris course) in Racket.  The computer maps the screen
> > > to a memory space where bits represent the pixel colors (black and
> > > white).
> > >
> > > Right now, I am generating the screen image by converting the bits to
> > > a vector of argb pixels and then converting it to bitmap using
> > > argb-pixels->pict and then pict-bitmap.  The screen updates 10 frames
> > > per second but this conversion bits->bitmap is a bottleneck even in
> > > this low rate of update.
> > >
> > > How would be a better approach for this process?  I can imagine how an
> > > incremental approach can be faster by only changing the necessary
> > > parts of the image, but my idea of representing the screen as a
> > > quadtree sounds too complex to be the right path.
> > >
> > > Thanks,
> > > Wanderley Guimarães
> > >
> > > --
> > > 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/CAAmHZocH9NaV2hwvQsi%2B_dXZy%3DT4nkPd-HmwhzTGKABh89kntg%40mail.gmail.com.
>
>
>
> --
> Abraço,
> Wanderley Guimarães

-- 
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/CAJYbDakT_JoFy6NG9oidymzk%3DFDhiNf-kasNz7wV9teQo7qvPw%40mail.gmail.com.


Re: [racket-users] How to efficiently simulate a video display

2019-10-22 Thread Jay McCarthy
I would use a really simple OpenGL draw call that just draws a
rectangle and update the texture contents with the screen bits.

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

On Tue, Oct 22, 2019 at 6:54 PM wanderley.guimar...@gmail.com
 wrote:
>
> Hi folks,
>
> I decided to write a computer simulator (16-bit machine as the one
> built in nand2tetris course) in Racket.  The computer maps the screen
> to a memory space where bits represent the pixel colors (black and
> white).
>
> Right now, I am generating the screen image by converting the bits to
> a vector of argb pixels and then converting it to bitmap using
> argb-pixels->pict and then pict-bitmap.  The screen updates 10 frames
> per second but this conversion bits->bitmap is a bottleneck even in
> this low rate of update.
>
> How would be a better approach for this process?  I can imagine how an
> incremental approach can be faster by only changing the necessary
> parts of the image, but my idea of representing the screen as a
> quadtree sounds too complex to be the right path.
>
> Thanks,
> Wanderley Guimarães
>
> --
> 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/CAAmHZocH9NaV2hwvQsi%2B_dXZy%3DT4nkPd-HmwhzTGKABh89kntg%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/CAJYbDamc_f5jEnJCPhrGB3iGJojUtEzYb4mm-r2xP_OU%3Djcr2Q%40mail.gmail.com.


Re: [racket-users] Seeking feedback on Vulkan integration progress

2019-10-17 Thread Jay McCarthy
This is really great.

For the unions, I'd recommend generating helpers that just call
`union-ref` and `union-set` that have the names you want.

For the type names, I agree; I would prefer to never leave out the
`_t`s because when I'm writing an FFI, I want to think like a C
programmer. C'est la vie.

Jay

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

On Thu, Oct 17, 2019 at 2:30 PM Sage Gerard  wrote:
>
> I finished generating C enums, bitsets, function pointers, structs, unions 
> and handle declarations from the Vulkan API registry. I wrote an article on 
> the topic with a link to the current output module [1].
>
> I tried using dynamic-ffi but hit an issue re: header selection that I expect 
> will be resolved [2]. I still intend to include use of it for those who 
> prefer its interface. My intended experience is for (require vulkan/unsafe) 
> to include Vulkan C-types into the module namespace.
>
> I'd like to ask anyone interested in this project and with Vulkan/FFI 
> experience to review the output code linked in the article and point out any 
> erroneous patterns. Since I'm learning ffi/unsafe as I go, I expect I've done 
> a few things wrong, or inefficiently. I'd want to know that sooner rather 
> than later.
>
> I hope to be test-ready by end of next week. After that comes extension 
> support, and finally porting @Erkaman's Mandelbrot set renderer to implement 
> the first test [3].
>
> ~slg
>
>
> [1]: https://sagegerard.com/racket-vulkan-types-done.html
> [2]: https://github.com/dbenoit17/dynamic-ffi/issues/27
> [3]: https://github.com/Erkaman/vulkan_minimal_compute
>
> --
> 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/ZhQGm7uHROBBlq-5Ff7WiItvvS-SeDeqNlwZMWmKWIReDK-9viFg_5RhdHDVGFzJs5QVGexdIRZ-YNhvL5wd0NJrvBo8cR0IjZV6kC-M5_s%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/CAJYbDa%3DzQaHu-C_wNURvBx8j3zGCDMose-sxvX_M4CRmGcoq2Q%40mail.gmail.com.


Re: [racket-users] I Need Help Bringing Vulkan to Racket

2019-10-09 Thread Jay McCarthy
Hi Sage,

You should model your implementation of Stephan's RacketGL ---
https://github.com/stephanh42/RacketGL --- which parses the spec.

If you also want to or need to capture parts of the headers, I recommend
David Benoit's dynamic-ffi --- https://github.com/dbenoit17/dynamic-ffi ---
for parsing them with Clang's library, rather than going with something
home grown.

I am very interested in making mode-lambda work on Vulkan. I have a Windows
computer that I could test on.

Jay

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


On Thu, Oct 10, 2019 at 5:56 AM Sage Gerard  wrote:

> I'm resuming work on a very early-stage project that generates FFI
> bindings for Vulkan in Racket [1]. VkTk is the closest relative project I
> have found for reference [2].
>
> Last time I was on the project I was focused on generating bindings from
> the API registry. That has not changed. I considered use of Dave Herman's C
> library [3] on vulkan.h directly, but the XML spec has supplemental data,
> and vulkan.h has preprocessor directives that I would like to capture for
> completeness.
>
> Once I am finished with the bindings. would anyone be available to
> contribute/run tests in the hopes that we can make this viable faster? I
> intend to run any applications on Windows 10 and a 1080Ti, but that's about
> all of the configurations that I can verify. I'll definitely need guinea
> pigs and feedback.
>
> [1]: https://github.com/zyrolasting/racket-vulkan
> [2]: https://github.com/awolven/VkTk
> [3]: https://docs.racket-lang.org/c-utils/index.html
>
> *~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/RsANZblSLyJViX1EDgDg-umCCJKCS6uYV84htPiRjjgAuW7G_3nx-fAOrLD7VMDqtEDkSKbm16jPyTWsAk1QyXCF8cz2CUi-mP04jrpmgn8%3D%40sagegerard.com
> <https://groups.google.com/d/msgid/racket-users/RsANZblSLyJViX1EDgDg-umCCJKCS6uYV84htPiRjjgAuW7G_3nx-fAOrLD7VMDqtEDkSKbm16jPyTWsAk1QyXCF8cz2CUi-mP04jrpmgn8%3D%40sagegerard.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAJYbDa%3DotA_tNaD1troPWF9XDoj_hg0dMKKpiR1xQV%2BKMip%2BHQ%40mail.gmail.com.


Re: [racket-users] Testing Servlets: exceptions not raised/passed through; how to pass extra arguments to tested servlet

2019-09-26 Thread Jay McCarthy
On Thu, Sep 26, 2019 at 5:46 AM Marc Kaufmann  wrote:
>
> Thanks for clearing this up. If I understand correctly, the following happens:
>
> - the servlet raises an exception
> - this is caught by the default exception handler
> - it prints the traceback and exception message to standard output which I 
> see (and which made me realize an exception had been raised), and it passes 
> the response to the servlet-tester. However, the exception didn't bubble up 
> to check-not-exn
>
> Since I can't turn off the exception handling of the servlets, I have to look 
> at the output to find that an exception was thrown. Could I pass a different 
> exception-handler to the test-servlet, which would return something easier 
> (and more robust) to check whether an exception was thrown or not? Or should 
> I bundle the servlet into a lambda for this, and have an exception-handler in 
> that lambda that simply outputs "exception-raised" or some such? Otherwise I 
> can of course parse the output, but that seems a little more error-prone.

I think you're thinking about this wrong. It is not that can't "turn
off the exception handling" or that "the exception didn't bubble up".
If you go to pkgs.racket-lang.org and there's an exception in the code
on the server, do you expect the Racket exception to be thrown to
Google Chrome where a `with-handlers` can catch it? Of course not.
`make-servlet-tester` is literally a network client. It starts up a
hidden server and connects to it.

So, you need to ask what it is that you are trying to test...

If you want to know if a certain Racket function throws an exception,
then just test that function directly and use `check-not-exn`. That's
what Rackunit, chk, and other libraries are for. In this case, you are
testing a Racket function for its behavior: so you ask "Racket"
questions, like "Are exceptions thrown?".

If you want to know if your servlet returns certain pages, then use
`make-servlet-tester` to inspect the pages that get generated. In this
case, you are testing a Web app for its behavior: so you ask "Web"
questions, like "Is the background of the page purple?".

Jay

-- 
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/CAJYbDa%3D%3DfSxLKyUNXx60k4TLA112%3Dtg%3DANy1qcD3CwhaHU6%3Dbg%40mail.gmail.com.


Re: [racket-users] Testing Servlets: exceptions not raised/passed through; how to pass extra arguments to tested servlet

2019-09-25 Thread Jay McCarthy
The output of `make-servlet-tester` returns the HTTP response object that
the servlet returns. `make-servlet-tester` really makes a HTTP connection
to your servlet and is checking the actual result that you sent back. If
the servlet throws an exception, then probably you have the default
exception handler which turns that into an HTML display. That HTML display
would be returned and thus, there was no exception. In other words, it is
not a sufficient test of what you want to check that no exception is
thrown, you want to make sure a desirable page is returned.

Jay

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


On Tue, Sep 24, 2019 at 9:34 AM Marc Kaufmann 
wrote:

> Hi all,
>
> I have gone through https://docs.racket-lang.org/web-server/test.html to
> finally stop manually checking whether I didn't introduce new bugs in one
> of my servlets. I think that I have figured out most of the wrinkles for
> this, except one.
>
> I run my tests via `raco test server.rkt`, and server.rkt has the
> following structure:
>
> (require web-server/test web-server/servlet ...)
>
> (define (start request)
>   (define-values (top-dispatch top-urls)
> (dispatch-rules
>   [("") home]
>   [("login") #:method (or "post" "get") log-in]
>   [("mp") #:method (or "post" "get") mp]
>   ...
>   ))
>
>   (top-dispatch request))
>
> (module+ main
>   (serve/servlet start ...))
>
> (module+ test
>
>   (define (test-start-servlet)
>
> (define experiment-servlet-tester
>   (make-servlet-tester start))
>
> ; Test all the routes. This only tests that they don't raise exceptions
> (define routes
>   (list
> '()   ; Tests "/"
> '("/login")
> '("/mp")
> ))
>
> (for ([route routes])
>   (check-not-exn (λ () (apply experiment-servlet-tester route
>
> (define matrix-servlet-tester
>   (make-servlet-tester (λ (req)
>   (matrix req #:h (hash 'mturk-id "TESTER")
>
> (matrix-servlet-tester)
>
> (displayln "All pages render without exception"))
>
>   (test-start-servlet))
>
>
> The meat of what is going on is in the test module at the end. I create a
> servlet-tester for the start servlet, which uses a dispatcher, and since I
> have a bunch of routes I go through them in a for-loop. However, even
> though the "/login" route throws an exception, the (test-start-servlet)
> code is happily marching on, checks the "/mp" route, and then prints "All
> pages render without exception". And raco test tells me that all the tests
> are passing!
>
> How do I know that there is an exn? Because it prints the following right
> before the test results:
>
> Servlet (@ /372d34a3-df04-478f-8d84-94fb212725c2) exception:
> >: contract violation
>   expected: real?
>   given: #
>   argument position: 1st
>   other arguments...:
>0
>
>
> So, what is going on here? Clearly test-servet does some exception
> catching in between, yet it still prints it to the screen? How can I test
> for this, since I want to know how many and which pages blow up?
>
> Also, when I want to test matrix at the end, I have to pass it an extra
> argument. Is it the right way of passing in the argument by defining a new
> servlet where I set the argument to some fixed value, as I do above via:
>
> (define matrix-servlet-tester
>   (make-servlet-tester (λ (req)
>   (matrix req #:h (hash 'mturk-id "TESTER")
>
> It seems to work, but I am wondering if I can pass arguments directly to
> `make-servlet-tester`, but I couldn't figure out how.
>
> Thanks,
> Marc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/a7ae5893-5bdd-4b3f-924a-42e4936d2a68%40googlegroups.com
> <https://groups.google.com/d/msgid/racket-users/a7ae5893-5bdd-4b3f-924a-42e4936d2a68%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAJYbDane6RA8pZpf65NnFO5tgyPRowSE1ggt5KD8cGNW1kP0NQ%40mail.gmail.com.


Re: [racket-users] Is there an expanded form of the Racket2 purpose declaration?

2019-08-28 Thread Jay McCarthy
Exactly. We don't change anything about Racket 1 in a way that makes
any adaption needed. That's why putting a new "#lang" at the top of
new programs is such a big deal, because we can have a new level to
have backwards compatibility with for the NEXT 25 years.

Jay

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

On Wed, Aug 28, 2019 at 12:36 PM Robby Findler
 wrote:
>
> I'm not sure this was clear, but I think the clear goal for backwards
> compatibility is that code that used to run continues to run
> indefinitely. With no changes. That's certainly what the Racket core
> developers mean by "backwards compatible".  In other words "requiring
> porting" is the opposite of "backwards compatible", at least in my
> mind.
>
> Robby
>
> On Wed, Aug 28, 2019 at 11:33 AM Breck Yunits  wrote:
> >
> > I'd recommend investing work to make the problem of porting Racket1 code to 
> > RacketN painless. Hopefully as simple as one method call.
> >
> > If translating Racket1 code to RacketX is made an easy problem, then you 
> > can do what is best for RacketX without worrying about how backwards 
> > compatibility.
> >
> > That would pay dividends in other areas as well, regardless of what 
> > direction Racket2 goes in.
> >
> >
> > On Wed, Aug 28, 2019 at 6:28 AM Jay McCarthy  wrote:
> >>
> >> My thoughts are in the thread you linked to:
> >>
> >> https://github.com/racket/racket2-rfcs/issues/105#issuecomment-521446706
> >> """
> >> I see Racket2 through the rubric of "We almost never break backwards
> >> compatible and insist on gradual evolution as the only way to make
> >> progress; but, now we are willing to make some radical changes: What
> >> can we do to make Racket drastically better that can't be expressed as
> >> an evolution?" In other words, I feel like Racket2 is defined as the
> >> goal, "Whatever makes Racket a lot better" and the design constraint,
> >> "It's okay to be incompatible."
> >> """
> >>
> >> When it comes specifically to syntax, which is what you seem to be
> >> asking about by reading the quote, here's a quote from my attempts to
> >> write this up before:
> >>
> >> https://github.com/racket/racket2-rfcs/pull/109/files#diff-f609e36bab3cb71c8829f58a5f9b2455R16
> >> """
> >> The uniformity of S-expressions limits the amount of information at
> >> the notational level of reading Racket programs. A small amount of
> >> extra notation can go a long way with a small number of mores on its
> >> use. For example, in Racket brackets are used in S-expressions when no
> >> function or macro application is implied (like in the cases of a
> >> `cond`); reading Racket programs without this notational affordance is
> >> more difficult. On the other hand, it is awkward to embed arbitrary
> >> fragments of code not in S-expression format, such as when quoting a
> >> program in another language. The only effective option is to embed a
> >> string. The Racket @-reader is helpful at this, but it is not
> >> uniformly available and the standard structure of Racket's
> >> S-expression based languages do not allow macro-specific reading of
> >> such syntaxes.
> >> """
> >>
> >> I'll add that I see S-expressions as obviously limited and it would be
> >> nice to make a more powerful syntactic extension system that does not
> >> say, "You can have anything you want, provided it is a parenthesis."
> >>
> >> So for me, I don't see the syntax mission as having anything to do
> >> with students or getting people to like me, I see it as a way to go
> >> beyond the limitations of S-expressions and do something more powerful
> >> and interesting. I think people will like us more after in as much as
> >> I think people like awesome things, and I want to make something
> >> awesome.
> >>
> >> Jay
> >>
> >> --
> >> Jay McCarthy
> >> Associate Professor @ CS @ UMass Lowell
> >> http://jeapostrophe.github.io
> >> Vincit qui se vincit.
> >>
> >> On Wed, Aug 28, 2019 at 1:09 AM David Storrs  
> >> wrote:
> >> >
> >> > The discussion on Racket2 seems to have moved offlist to the RFC list on 
> >> > github (https://github.com/racket/racket2-rfcs/issues); are there other 
> >>

Re: [racket-users] Is there an expanded form of the Racket2 purpose declaration?

2019-08-28 Thread Jay McCarthy
My thoughts are in the thread you linked to:

https://github.com/racket/racket2-rfcs/issues/105#issuecomment-521446706
"""
I see Racket2 through the rubric of "We almost never break backwards
compatible and insist on gradual evolution as the only way to make
progress; but, now we are willing to make some radical changes: What
can we do to make Racket drastically better that can't be expressed as
an evolution?" In other words, I feel like Racket2 is defined as the
goal, "Whatever makes Racket a lot better" and the design constraint,
"It's okay to be incompatible."
"""

When it comes specifically to syntax, which is what you seem to be
asking about by reading the quote, here's a quote from my attempts to
write this up before:

https://github.com/racket/racket2-rfcs/pull/109/files#diff-f609e36bab3cb71c8829f58a5f9b2455R16
"""
The uniformity of S-expressions limits the amount of information at
the notational level of reading Racket programs. A small amount of
extra notation can go a long way with a small number of mores on its
use. For example, in Racket brackets are used in S-expressions when no
function or macro application is implied (like in the cases of a
`cond`); reading Racket programs without this notational affordance is
more difficult. On the other hand, it is awkward to embed arbitrary
fragments of code not in S-expression format, such as when quoting a
program in another language. The only effective option is to embed a
string. The Racket @-reader is helpful at this, but it is not
uniformly available and the standard structure of Racket's
S-expression based languages do not allow macro-specific reading of
such syntaxes.
"""

I'll add that I see S-expressions as obviously limited and it would be
nice to make a more powerful syntactic extension system that does not
say, "You can have anything you want, provided it is a parenthesis."

So for me, I don't see the syntax mission as having anything to do
with students or getting people to like me, I see it as a way to go
beyond the limitations of S-expressions and do something more powerful
and interesting. I think people will like us more after in as much as
I think people like awesome things, and I want to make something
awesome.

Jay

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

On Wed, Aug 28, 2019 at 1:09 AM David Storrs  wrote:
>
> The discussion on Racket2 seems to have moved offlist to the RFC list on 
> github (https://github.com/racket/racket2-rfcs/issues); are there other 
> locations?
>
> There is one question that I had back at the beginning of the process that I 
> didn't manage to get clarity on, which is the rationale behind the whole 
> thing.  I've gone back through some of the email discussion and gone through 
> all 4 pages of the issues lists and read everything that seemed relevant.  
> The most apropos thing seems to be this:  
> https://github.com/racket/racket2-rfcs/issues/105 but it still doesn't really 
> speak to my question.
>
> My current understanding is that the rationale for the Racket2 effort looks 
> something like this:
>
> "We, the core developers, many (all?) of whom are also academics with a lot 
> of experience teaching Racket to new programmers, have noticed that 
> parentheses and prefix notation are a stumbling block for many students.  We 
> would like to help the ideas of Racket spread into the larger community.  
> Therefore, we want to produce Racket2, which will have all the power of 
> Racket but will get rid of parens and use infix notation, which will be more 
> familiar and intuitive to students.  We also see this as a great time to 
> improve existing elements of the language based on what we've learned since 
> they were added, and potentially add new features."
>
> Is this in fact correct?  Is there more specific discussion of it somewhere 
> that I've missed?  I don't want to make people retread the issue if it's 
> already clearly laid out elsewhere.
>
> --
> 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/CAE8gKodAh%2BdO3v8bx0bmPJYUhtDmVgX2KrxH8N3QwtG43aX%2BYg%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/CAJYbDan4dqov1uswGhpe_Q7Tmh%3DyO6zQ6FwyU7XY6fnqXPgdfg%40mail.gmail.com.


Re: [racket-users] web-server: how to save database results in memory across all requests?

2019-08-13 Thread Jay McCarthy
I think it is pretty simple.

```
(define (make-periodically-updating-value compute1)
  (define the-data (box (compute1)))
  (define the-updater-t
(thread
 (λ ()
   (let loop ()
 (set-box! the-data (compute1))
 (sleep interval)
 (loop)
  (λ ()
(unbox the-data)))

(define get-the-data/cache
  (make-periodically-updating-value get-the-data/for-realsies))
```

Box mutation is atomic, so you don't need locks or anything. It would
be more complicated if you want to not compute it initially.

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

On Tue, Aug 13, 2019 at 7:53 PM Wayne Harris  wrote:
>
> Is there an example somewhere showing how this could be done?  My wish is to 
> have one thing (a thread or something) periodically updating data (say every 
> 30 minutes) and all servlets handling http connections reading.  It is 
> perfectly fine for me if while something writes the data, everything else is 
> blocked waiting.
>
> Having said that, I think this might be getting out of my league.  (I'm 
> reading about events in the hope I can find a way.)  I have very basic 
> understanding of Racket's primitives; never done anything involving threads 
> or any kind of concurrency.  If there's no trivial way to do that, I'll leave 
> it for some other future project.
>
> On Tuesday, August 13, 2019 5:07 PM, Jay McCarthy  
> wrote:
>
> > Hi Wayne,
> >
> > Your `in-memory-database` is a parameter. Parameters are
> > thread-specific storage [1]. Every request in the web-server is
> > handled by a different thread, so I think this will not work how you
> > think it should.
> >
> > Jay
> >
> > 1.  
> > https://docs.racket-lang.org/reference/parameters.html#(form._((lib._racket%2Fprivate%2Fmore-scheme..rkt)._parameterize))
>

-- 
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/CAJYbDa%3D4vGyGVNjGBTMeNW30hjWK2UMvA8-8ynd5CLpkFMYnug%40mail.gmail.com.


Re: [racket-users] web-server: how to save database results in memory across all requests?

2019-08-13 Thread Jay McCarthy
Hi Wayne,

Your `in-memory-database` is a parameter. Parameters are
thread-specific storage [1]. Every request in the web-server is
handled by a different thread, so I think this will not work how you
think it should.

Jay

1. 
https://docs.racket-lang.org/reference/parameters.html#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._parameterize%29%29

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

On Tue, Aug 13, 2019 at 11:47 AM 'Wayne Harris' via Racket Users
 wrote:
>
> I'd like to save database results in memory because my database only changes 
> between long time intervals.  By building a minimum application, I see my 
> cache-strategy seems to work per servlet: by opening a new browser, the first 
> request yields a cache-miss.
>
> Looking through the documentation, I got the idea that perhaps I should 
> serve/servlet using
>
>#:servlet-namespace '("shared-model.rkt")
>
> where shared-model.rkt is the module that talks to the database and 
> implements the caching-strategy.  But adding this keyword to serve/servlet 
> did not make any perceived difference.
>
> What should I do to save results in memory across all requests?
>
> --- server.rkt
> --
> #lang racket/base
> (require
> web-server/servlet
> web-server/servlet-env
> (prefix-in model: "shared-model.rkt"))
>
> (define-values (dispatch url)
>   (dispatch-rules
>(("main") db->response)
>(("update" (string-arg)) update->response)))
>
> (define (update->response r s)
>   (define str (model:in-memory-db-set-and-get s))
>   (displayln str)
>   (string->response str))
>
> (define (db->response r)
>   (string->response (model:get-in-memory-results)))
> ;; no more api endpoints ==/==
>
> (define (string->response s)
>   (response/full 200 #"Okay" (current-seconds)
>  TEXT/HTML-MIME-TYPE '() (list (string->bytes/utf-8 s
>
> (define (file-not-found r)
>   (response/xexpr "File not found."))
>
> (module+ main
>   (file-stream-buffer-mode (current-output-port) 'line)
>   (define (main)
> (displayln "Now serving...")
> (serve/servlet dispatch
>;; #:servlet-namespace '("shared-model.rkt")
>#:stateless? #t
>#:log-file (build-path "logs/httpd.log")
>#:port 
>#:listen-ip "127.0.0.1"
>#:servlet-path "/"
>#:servlet-regexp #rx""
>#:extra-files-paths (list (build-path "pub/"))
>#:server-root-path (build-path "/")
>#:file-not-found-responder file-not-found))
>   (main))
> ---
>
> --- shared-model.rkt
> ---
> #lang racket/base
> (define in-memory-database (make-parameter #f))
> (define (in-memory-db-set-and-get x)
>   (in-memory-database (format "~a: data to be shared across servlets" x))
>   (in-memory-database))
>
> (define (get-in-memory-results [refresh? #f])
>   (if refresh?
>   (begin (displayln "database: force refresh")
>  (in-memory-db-set-and-get "forced"))
>   (let ([in-memory-db (in-memory-database)])
> (if in-memory-db
> (begin (displayln "database: cache hit")
>in-memory-db)
> (begin (displayln "database: cache miss")
>(in-memory-db-set-and-get "miss"))
> (provide (all-defined-out))
> ---
>
> --
> 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/Xuxg1t5egDEkFLVsH-Ch9KZyTqtLjhATNOPD-HeXZgcOc2mXr8qlXS3fZTZRh90xd2kvhdILhNjKwUllUirBcnTrEzPDTiw_hJDVEp5FjpM%3D%40protonmail.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/CAJYbDa%3DfCWDuk_MdOUokhF4sOaLe3_fGq24SJDRSDFCG%3DFRsZA%40mail.gmail.com.


Re: [racket-users] Re: Retina display for OpenGL

2019-08-03 Thread Jay McCarthy
There's two steps to using the hires mode on OS X.

First, you need the OpenGL configuration to be in hires-mode.

Second, you need to set the viewport in your OpenGL code to the result
of `get-gl-client-size`, not `get-scaled-client-size` or
`get-client-size`, which are all very similarly sounding functions.

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


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


On Thu, Aug 1, 2019 at 10:39 AM 'Mark Warren' via Racket Users
 wrote:
>
> That's a shame, I'm afraid I'm out of ideas then. Hopefully someone else will 
> know.
>
> On Thursday, 1 August 2019 14:36:07 UTC+1, Kshitij Sachan wrote:
>>
>> I've set up an OpenGL context that is displayed in a snip (I chose a snip 
>> because I want to be able to move the camera around and generally respond to 
>> user input). However, I've noticed that the OpenGL context in Racket looks 
>> considerably worse than when I run the same OpenGL code in C++ (the racket 
>> code is actually calling a C library function using the FFI).
>>
>> I believe this is because the Racket snip isn't able to take advantage of 
>> the Retina display on my Mac. Is this the correct reason, and if so, is 
>> there any way to fix this and make the quality better?
>
> --
> 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/0452ca69-81f7-45e0-9718-3ca95a42ce68%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/CAJYbDakfdi_ptCJLAEbt-VbBYZWWTuFT9OKxGS1c6LP4_LT4kg%40mail.gmail.com.


Re: [racket-users] Racket2 possibilities

2019-07-21 Thread Jay McCarthy
On Sun, Jul 21, 2019 at 1:12 PM Alexis King  wrote:
> It is easy to foresee a transition away from s-expressions as a restriction 
> on what can be expressed via macros, mostly since non-s-expression languages 
> with macro systems (such as Haskell and Elixir, to name just two) usually 
> impose such restrictions. But that is what is so remarkable about Honu: its 
> macros allow what is really a superset of Racket’s current syntactic 
> flexibility. I think the paper has a good explanation of why this is, I just 
> don’t think it points out the implications explicitly enough, so if this is a 
> surprise to you, go back and take another look.

This point by Alexis, IMHO, is the big reason for thinking about
Racket2 for me. The parenthesis notation of Racket is a restriction to
make certain things easy, but we now know a lot more than we did in
the past, so we can keep those things easy while removing the
restriction that keeps us from doing more interesting things.

Jay

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

-- 
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/CAJYbDamD75CtipY3TQLaNDsVAGq4Os8kziqzZqBT0ZjATiZTzg%40mail.gmail.com.


Re: [racket-users] Racket2 possibilities

2019-07-20 Thread Jay McCarthy
As a procedural matter, I think that the Github repository is a great
way to communicate about specific ideas in way that ideas stay
connected and don't get forgotten.

https://github.com/racket/racket2-rfcs/

Right now, basically all of the discussion is in the issues, as people
work together to gather ideas. I think eventually we need to try to
write longer-form proposals about the details.

I think Matthew's point about trying to write down some concrete
examples would be extremely valuable as issues to spur discussion.

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

On Sat, Jul 20, 2019 at 2:49 PM Matthew Flatt  wrote:
>
> This message is intended as a prose form of what I said at RacketCon,
> but it includes some extra explanation triggered by the discussion so
> far. Where that happens, I apologize that it isn't in the form of a
> more direct response in the original thread.
>
> The Racket2 Idea
> 
>
> Racket's design and implementation is on solid ground, and from this
> point, it can continue to evolve and improve in many ways. No matter
> how Racket evolves, the community is committed to preserving what we
> have achieved: today's `#lang racket` programs will run in the future,
> and today's `#lang racket` modules can be used in future Racket
> programs. At the same time, the current language design may be close to
> a local maximum, and it's not in the nature of the Racket community to
> be satisfied with a local maximum.
>
> By starting all programs with `#lang`, we have created a path to leap
> from one peak of design to a different, higher peak without sacrificing
> the old one and while staying Rackety. Roughly, that's what we mean by
> "Racket2". The name "Racket2" stands for some language that builds on
> the current Racket technology and implementation, but that may not
> directly accommodate the same bindings and expression forms that appear
> in the body of a `#lang racket` module.
>
> Although we could literally write `#lang racket2` for modules in the
> new language, "Racket2" is normally understood as a placeholder for a
> more distinct name. As a matter of branding, perhaps the language would
> be called "Racket X" for some good X --- shortened to "X" in some
> contexts --- and Racket X program would be written with `#lang X` line
> at the top. Maybe the name depends on how different Racket2 turns out
> to be from Racket, so it makes sense to pick a name later.
>
> Venturing out from Racket's current peak opens a large space of
> possibilities, so the first step is to agree on a set of goals to be
> met by the next peak. The goals can serve as a starting point for
> developing roadmap for deciding on technical details in a follow-up
> process.
>
> Possible Language Changes
> -
>
> The Racket community has long discussed possibilities for Racket2. Here
> are a few potential changes from the wish list:
>
> * Rename functions to make the conventions more uniform, and make
>   better use of keyword arguments to reduce names and increase
>   consistency.
>
> * Change structures types to have more or fewer features.
>
> * Use generic datatypes (such as streams) pervasively, instead of
>   writing code that expects a particular concrete representation (such
>   as lists).
>
> * Make strings immutable by default (e.g., result of `format` or
>   `string-append`).
>
> * Adjust the semantics of common syntax forms, such as raising an error
>   on fall-through for `cond` or `match`, and change the meaning of some
>   primitives, such as making `integer?` mean "exact integer".
>
> * Make pattern matching more pervasive and available by default.
>
> * Change module, evaluation, and loading callbacks (e.g., protocol for
>   `current-module-name-resolver`) to improve errors and extensibility.
>
> More changes have been suggested, and no doubt many other changes would
> make sense. As a first cut, to synthesize some principles from these
> ideas --- as a way of selecting which wishes should be tackled and how
> --- the current wish list might be organized and summarized by two
> overall goals:
>
> * Make the language more consistent
>
>   Consistency means making terminology and binding names more
>   consistent, and it means unifying related syntactic constructs. For
>   example, the `define` and `define-syntax` forms should perhaps be
>   less syntactically distinct. Similarly, pattern matching and syntax
>   matching seem closely related and could benefit from using the same
>   pattern language. Also, pattern matching should be pervasively
>   available among binding forms. Etc.
>
> 

[racket-users] RacketCon Live Stream

2019-07-12 Thread Jay McCarthy
RacketCon is tomorrow!

https://con.racket-lang.org/

There will be a live stream!

https://youtu.be/xSjk2PdQm5k

See you at 0930 Mountain Time!

Jay

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

-- 
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/CAJYbDak0B0jMDUdC3GwrwzewmDfQ3ycwNos%3DSJJiNnwDZ6HDOQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] HTML rendering

2019-06-21 Thread Jay McCarthy
As far as I can tell, it has been 16 years since that code has been touched
for anything other than reformatting.

https://github.com/racket/drracket/commit/55dc93d01f6a8113dae46302812debddc1e7d2d8

You should not consider it as a real HTML renderer in Racket.

Jay

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


On Fri, Jun 21, 2019 at 3:10 PM James Platt  wrote:

> I've been looking at HTML rendering in Racket and the Browser package
> looks interesting, especially since it can execute Racket code from a
> special HTML tag.
>
> https://docs.racket-lang.org/browser/index.html
>
> The problem is that the rendering it does is too simple.  It's about on
> the level of Lynx and doesn't even render tables.  Is there another option
> that I am missing, like something implementing Gecko or KHTML/Webkit?  If
> not is there much interest in creating such a thing? The idea would be to
> be able to have a Racket GUI with a component implemented in HTML + CSS.
>
> James
>
> --
> 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/99A41261-8EF1-47FA-9626-5E749E22BCA7%40biomantica.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAJYbDanmvwwX9zUzMDxPcXqHX1GcCFkVovS0QHdN5DcEhsxeZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Racket Week Housing - Deadline is 06/21

2019-06-14 Thread Jay McCarthy
Racket Week is less than a month away! The dorm housing signup for the
workshops is closing soon. You'll have until 06/21 to register for it.

https://school.racket-lang.org/#housing

The details are at the link, but in summary, it's $40/night at the
University of Utah dorms.

Jay

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

-- 
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/CAJYbDamgeBN1VOQRVtb4u2uWKNnac0a2Y2f08Sj_RQmqmzswOg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] grammar-based fuzzing

2019-06-06 Thread Jay McCarthy
`redex-check` is what you want. If it isn't exactly what you need,
then `data/enumerate` will help you build what you need very easily.

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

On Thu, Jun 6, 2019 at 3:21 PM Ryan Kramer  wrote:
>
> Does Racket have any grammar-based fuzzing utilities? I'm probably going to 
> play around with this either way, but if there is an existing solution I'll 
> quit after I've had my fun. If, however, people think Racket could use 
> something like this I may attempt to make it into a usable package.
>
> I'm thinking specifically about generating inputs for Quickcheck, but such a 
> fuzzer might have other uses.
>
> For example, given this grammar:
>
> (struct tree (left right) #:transparent)
>
> (define-grammar tree-grammar
>   [Leaf (:choose-integer - )]
>   [Subtree #'(tree Node Node)]
>   [Node #:max-nesting 10
> (:weighted-choice
>  [1 Leaf]
>  [5 Subtree])])
>
> Then (tree-grammar 'Subtree) might generate #'(tree 1 (tree 2 3)) as one of 
> many possibilities.
>
> An important feature that I haven't seen yet is tracking/scoping identifiers. 
> There are times when we want to generate any arbitrary identifier, and other 
> times when we want to use an existing identifier that we know is in scope. 
> For example, if we were fuzzing `let` we might have
>
> (define-grammar let-grammar
>   [Root #'(let ([LetId LetVal]
> ...)
> LetBody)]
>   [LetId (:choose-identifier)]
>   ; TODO ...
>   )
>
> And somehow we want to say that LetBody can and should use the enclosing 
> LetIds, but I don't immediately see a great way to communicate that. It might 
> be possible to have something like (:choose-bound LetId) which would generate 
> a LetId that is known to be in scope.
>
> --
> 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/832ed76d-33f6-4f3f-b80f-da891613b6a3%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CAJYbDakB4emkdCO_noMaB6v_-RQUU1AJS_KBAQYprpkH%2BOCZaw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Are function parameters copy on write?

2019-06-06 Thread Jay McCarthy
On Thu, Jun 6, 2019 at 12:16 PM David Storrs  wrote:

>
>
> On Thu, Jun 6, 2019 at 12:14 PM Jay McCarthy 
> wrote:
>
>> Your code is passing bytes by value, but bytes are themselves
>> pointers, so you are passing copies of the pointer, not copies of the
>> bytes. When you modify it, with `bytes-set!` you are modifying the
>> underlying structure. When you copy it with `subbytes` or
>> `bytes-copy`, you are making a new object with a new pointer.
>>
>
> Sweet, that's what I needed to know.  Thank you.
>
> What about other things, like arbitrary structs, (im)mutable strings,
> hashes, etc?
>

Everything is like this except word sized objects like numbers but those
are not mutable so you’d never know the difference (performance would be
same too because the pointer would be word sized anyways.)


>
>
>> --
>> Jay McCarthy
>> Associate Professor @ CS @ UMass Lowell
>> http://jeapostrophe.github.io
>> Vincit qui se vincit.
>>
>> On Thu, Jun 6, 2019 at 12:00 PM David Storrs 
>> wrote:
>> >
>> > My understanding is that Racket is call by value, not call by
>> reference.  My application will often be passing around large-ish byte
>> strings; will they be copied every time I pass them, or will the
>> interpreter use copy-on-write?
>> >
>> > --
>> > 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/CAE8gKod0Z%2Bv-3Oew4mPhsT4mwzOLdhc7Q-nF4xf_yH3qAgq_Hg%40mail.gmail.com
>> .
>> > For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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/CAE8gKodNrutKxDivmbpH7Pz_Y1Hg0BfiavQagVToYdm%2BHsr-%3DQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/racket-users/CAE8gKodNrutKxDivmbpH7Pz_Y1Hg0BfiavQagVToYdm%2BHsr-%3DQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 

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

-- 
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/CAJYbDa%3DEF0BxMKeGy%2BVCB9iM7Rit-i%3Dy%3DfXFNpQK3Xbw7NKR3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Are function parameters copy on write?

2019-06-06 Thread Jay McCarthy
Your code is passing bytes by value, but bytes are themselves
pointers, so you are passing copies of the pointer, not copies of the
bytes. When you modify it, with `bytes-set!` you are modifying the
underlying structure. When you copy it with `subbytes` or
`bytes-copy`, you are making a new object with a new pointer.

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

On Thu, Jun 6, 2019 at 12:00 PM David Storrs  wrote:
>
> My understanding is that Racket is call by value, not call by reference.  My 
> application will often be passing around large-ish byte strings; will they be 
> copied every time I pass them, or will the interpreter use copy-on-write?
>
> --
> 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/CAE8gKod0Z%2Bv-3Oew4mPhsT4mwzOLdhc7Q-nF4xf_yH3qAgq_Hg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CAJYbDam4SpLL-vt0q78NpqT_GbxVeLhxkN_UWKB%3DTsKz2zsE%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket School tuition

2019-06-04 Thread Jay McCarthy
The financial aid means everything is paid for.

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

On Tue, Jun 4, 2019 at 8:35 PM Shaobo He  wrote:
>
> Hello everyone,
>
> Can I ask a question about Racket School here? I got the financial aid, do I 
> still need to purchase the ticket or it's waived?
>
> Thanks,
> Shaobo
>
> --
> 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/93c59be2-7d03-40ad-8e8c-ab7d8a69f50e%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CAJYbDanP-tC-5GMMTMKDQR_VXaAzAgJCc9Rozrq_7ExSASbHpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: New Package: Dynamic FFI - Write C Code Inline

2019-06-03 Thread Jay McCarthy
We're already on it...

https://github.com/jeapostrophe/adqc

See an example here:

https://github.com/jeapostrophe/adqc/blob/master/t/fib.rkt

It'll be more than just C though, because we'll be generating
verification conditions and we'll allow you to enforce time and space
bounds.

Jay

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

On Mon, Jun 3, 2019 at 11:53 AM zeRusski  wrote:
>
> Oh wow! IIUC it is super awesome. Would a natural next step be #lang terra?
> Hey Jay McCarthy would you like to mentor that effort ;-)
>
>
> On Saturday, 1 June 2019 20:06:29 UTC+1, David Benoit wrote:
>>
>> Hi All,
>>
>> I've recently released a new library for dynamically generating FFI bindings 
>> to C by parsing header files.
>> It also allows users to create FFI libraries by writing C functions directly 
>> inline in Racket programs.
>>
>> The library works as a native extension to Racket by linking with Clang's 
>> parser libraries and converting AST declarations into FFI objects.
>> As a result, the package depends on Clang and LLVM headers and libraries.  
>> See the documentation for info on installing dependencies.
>>
>> I've only built the package on GNU/Linux so far.  If anyone is interested in 
>> building the library on other OSes, it should be a fairly trivial port.
>>
>> I'd like to give a special thanks to Jay McCarthy, who came up with the idea 
>> for this project and was my adviser during its implementation.
>> I hope its something the Racket community might find useful!
>>
>> More usage examples are available in the docs and the test directory in the 
>> source code.
>>
>> Thanks!
>> David B
>>
>> I'll sign off with a quick preview:
>>
>> #lang at-exp racket/base
>>
>> (require dynamic-ffi/unsafe)
>>
>> @define-inline-ffi[struct-test]{
>>   #include 
>>   #include 
>>   #include 
>>
>>   typedef struct {
>> char *name;
>> uint64_t value;
>>   } number;
>>
>>   char* names[] = {"zero", "one", "two", "three", "four", "five", "six"
>>  "seven", "eight", "nine", "ten", "eleven", "twelve"};
>>
>>   number add(number a, number b) {
>> number c;
>> c.value = a.value + b.value;
>> if (c.value >12)  {
>>   fprintf(stderr, "error: this example can only count to twelve...\n");
>>   exit(1);
>> }
>> c.name = names[c.value];
>> return c;
>>  }
>> }
>>
>> ;; _list-structs are created by default.  I hope to optimize this in the 
>> future.
>>
>> (define n2 (list "two" 2))
>>
>> (define n7 (list "seven" 7))
>>
>> (printf "add(n2, n2): ~a\n" (struct-test 'add n2 n2))  ;; output: add(n2, 
>> n2): (four 4)
>> (printf "add(n7, n7): ~a\n" (struct-test 'add n7 n7))  ;; output: error: 
>> this example can only count to twelve...
>>
>>
>>
>>
>>
> --
> 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/628bf864-d261-481b-962c-2e54be297228%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CAJYbDa%3DVWBy6vc3C8Ag6JWtYsbEwGL_pyozzM5-DAuzexDo1tw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] RacketCon - Saturday Social and Sunday events

2019-05-30 Thread Jay McCarthy
As I'm sure you've noticed, we updated the RacketCon site today:

https://con.racket-lang.org/

Visit today to find out...

1) What the title of the keynote is!

2) Where we will be doing a social event on Saturday evening!

3) What is happening on Sunday!

We hope that you will tell all your friends, as it is only about a month away!

We have so excite!

Jay

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

-- 
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/CAJYbDanoPCdnTmEfSU07sA-NgHqDrrV97DWZg8EOzPHUsAiz0g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Confused about testing web applications

2019-05-30 Thread Jay McCarthy
You may be interesting in the `web-server/test` library:

https://docs.racket-lang.org/web-server/test.html

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

On Thu, May 30, 2019 at 2:24 PM Comrade SparklePony
 wrote:
>
> Hello,
>
> I'm new to Racket, and to gain facility with it I have been trying to 
> write small webapps, i.e. a simple calculator, using the built-in web 
> framework. However, I have found myself stuck when trying to implement tests 
> for some of the functions the webapp provides-- I am not sure how to test 
> functions that process a request. Specifically, I'm trying to write tests for 
> an "process-request" function which turns a request into a Calculator struct. 
> I'm confused if this is one of the unlikely scenarios in which a request 
> struct needs to be made, or if there is a better way to generate a request 
> with certain bindings.
>
> If a request struct does need to be made, can I just place an arbitrary 
> instance of the required data type in each field (except for 
> bindings/raw-promise)? I can just place a list of binding:form in the 
> bindings/raw-promise field, right?
>
> I apologize if I missed something obvious or this is an obnoxious noob 
> question.
>
> Some information that may or may not be helpful:
> - Racket experience so far: completed HTDP, webapp tutorial.
> - Sources consulted so far:
> - Racket documentation on HTTP, formlets, testing servlets, rackunit, 
> contracts, and delayed evaluation.
> - Racket webapps hosted on github (I couldn't find any that had used 
> tests)
> - Github link of the project so far
>
> 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/637db0d5-47a8-4fb6-a2a5-b79fc58a2672%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CAJYbDamg1ZMmYKFbZ6d6LLmmbdR2wD1Pzq_cmRL5a3Zu%2BksYGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Module not updating on the package server?

2019-04-30 Thread Jay McCarthy
Rescanning never did that. It just re-downloads from Github (or
wherever) and updates the record that the build server queries
nightly.

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

On Tue, Apr 30, 2019 at 3:59 PM David Storrs  wrote:
>
>
>
> On Tue, Apr 30, 2019 at 3:23 PM Sam Tobin-Hochstadt  
> wrote:
>>
>> The pkg-build server runs only once a day, so it will pick up your
>> changes in the next run.
>
>
> ??  When I've done "rescan all my packages" in the past it's rebuilt the 
> package.  Did something change or am I just clueless?
>
>
>>
>> Sam
>>
>> On Tue, Apr 30, 2019 at 3:16 PM David Storrs  wrote:
>> >
>> > Hi all,
>> >
>> > I just pushed an update to the test-more module.  On the package server it 
>> > was marked as 'New!' and was up to the latest commit, but the build status 
>> > was 'fails'.  The compilation report is from April 18.  I thought I'd take 
>> > a second chance, so I pushed another update, but no joy.  Is there any way 
>> > for me to make this update or could one of our wonderful maintainers kick 
>> > the server for me?
>> >
>> > Dave
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "Racket Users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an 
>> > email to racket-users+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

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


[racket-users] Racket Week Hotel Block and Summer School Housing

2019-04-30 Thread Jay McCarthy
We are happy to announce the hotel block for RacketCon at the Little America:

https://reservations.travelclick.com/4650?groupID=2537449#/guestsandrooms

It's a limited number of rooms --- only 7 singles and 3 doubles. So,
sign up quickly!

If you are attending the summer schools (How to Design Languages or
Beautiful Racket), then we have subsidized housing available. These
are rooms in the 4-bedroom, 2-bathroom suites on the University of
Utah campus dorms. The cost is $40/night.

Please register for a dorm room here:

https://forms.gle/spaMYg1LL4CK3J8p9

See you in July!

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

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


Re: [racket-users] Re: RacketCon: These 8 INSANE talks about Racket will change your life! I can't believe #7! --- (ninth RacketCon) on July 13th, 2019 --- Speakers Announced!

2019-04-29 Thread Jay McCarthy
You are correct that this is the Saturday schedule.

I'll be announcing the Sunday schedule later, but to give you and
careful readers of the mailing list a preview... we'll have a "state
of the Racket" presentation from Matthew, we'll do concurrent #lang
and game jams, with a little bit of a tutorial for the game side. I'm
also considering organizing a data science hackthon for things like a
table library, an AWS Lambda runtime, and a few other tools.

Jay

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

On Mon, Apr 29, 2019 at 2:56 PM joeld via Racket Users
 wrote:
>
> The schedule covers one day, I assume this is the Saturday? What is the 
> Sunday schedule?
>
> Already bought ticket, trying to assemble enough info to book flights with 
> confidence at great low prices!
>
> On Thursday, April 25, 2019 at 3:06:41 PM UTC-5, Jay McCarthy wrote:
>>
>> (ninth RacketCon) on July 13th, 2019
>>
>> Speakers Announced!
>>
>> https://con.racket-lang.org/
>>
>> Sign up for RacketCon!
>>
>> See you in Salt Lake City!
>>
>> --
>> Jay McCarthy
>> Associate Professor @ CS @ UMass Lowell
>> http://jeapostrophe.github.io
>> Vincit qui se vincit.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

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


[racket-users] RacketCon: These 8 INSANE talks about Racket will change your life! I can't believe #7! --- (ninth RacketCon) on July 13th, 2019 --- Speakers Announced!

2019-04-25 Thread Jay McCarthy
(ninth RacketCon) on July 13th, 2019

Speakers Announced!

https://con.racket-lang.org/

Sign up for RacketCon!

See you in Salt Lake City!

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

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


Re: [racket-users] Does Racket have a sexp-syntax regular expressions?

2019-03-27 Thread Jay McCarthy
https://docs.racket-lang.org/parser-tools/Lexers.html#%28part._.Lexer_.S.R.E_.Operators%29

On Wed, Mar 27, 2019 at 8:45 AM zeRusski  wrote:
>
> No wait. I meant SRE-like to match strings, not TRX to match trees. Messed up 
> there, sorry
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


[racket-users] ANN: RacketCon Keynote Speakers; You won't believe #9!

2019-03-18 Thread Jay McCarthy
This year from July 8th to the 14th is Racket Week. Come and see.

During the body of the week are the school workshops. Come and see.

https://school.racket-lang.org/

Afterwards is RacketCon itself, for two days. Come and see.

https://con.racket-lang.org/

We're happy to announce that the keynote speaker is Aaron Turon, a
leader on the Rust team at Mozilla. Come and see.

https://aturon.github.io/about/

If you'd like to apply to present, send me an email.

<3

Jay

-- 
-=[     Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Accomodation on the Racket School 2019 page

2019-03-18 Thread Jay McCarthy
What we have done in the past is gathering a list of who wants the
subsidized housing, then collect the fee from them (last year it was
$40 per night), and directly negotiate with the housing. We need to
arrange it with them so that all our people are in roughly the same
building and not too interspersed with the soccer camps, and so on. If
you are curious what the rooms are like, we normally get put in
Benchmark Plaza ---
https://d2vxd53ymoe6ju.cloudfront.net/wp-content/uploads/sites/2/20180108093435/Benchmark-Combined-Floor-Plans.pdf

On Mon, Mar 18, 2019 at 12:15 PM Christopher Lemmer Webber
 wrote:
>
> According to https://school.racket-lang.org/#accommodation
> there's subsidized lodgin at the University of Utah dorms.
> Sounds great!  But it's not really clear to me which buildings it would
> be at or where I should contact them.  Maybe this is useful info to
> clarify on the website?
>
> I see that contact info is listed at the bottom of:
> https://housing.utah.edu/
>
> Should I just call that? :)
>
> Not really sure myself, so I figured others may also be unsure, and I
> don't see a contact link on the Racket School page, so I figured I'd
> email the list.  Hope it isn't too awkward!
>
>  - Chris
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Pretty display of tabular data?

2019-03-13 Thread Jay McCarthy
I started with the good text-table library, but found I wanted more
and more other drawing tools and ended up making something pict-like
for the terminal.

On Wed, Mar 13, 2019 at 2:26 PM Jay McCarthy  wrote:
>
> 90% of the reason I made `raart` is because of this.
>
> https://docs.racket-lang.org/raart/index.html#%28def._%28%28lib._raart%2Fdraw..rkt%29._table%29%29
>
> (require raart
> (draw-here (table (text-rows THE-TABULAR-DATA)))
>
> Jay
>
> On Wed, Mar 13, 2019 at 2:19 PM Matt Jadud  wrote:
> >
> > Hi all,
> >
> > I have a tabular data type that I'd like (I think) to be able to render it 
> > either in ASCII or in a prettier way in the Interactions pane. I've 
> > explored gen:write and friends, and can get the struct to display the way I 
> > want---with ASCII. Essentially easy-peasy.
> >
> > What I wonder is: am I able to do something prettier? Can I encapsulate 
> > some kind of styled rendering as a snip%, or... something... so that I can 
> > render the first 5 and last 5 rows of a table with bolding of headers, etc.?
> >
> > I don't know where to start, essentially, if I wanted to try and do this. 
> > Or, perhaps it is not particularly doable.
> >
> > Pointers to examples in codebases are welcome (if such examples exist), and 
> > I can work from there. Or, indications that this might be really difficult 
> > are also welcome.
> >
> > Cheers,
> > Matt
> >
> > (Apologies if this somehow comes through twice... I sent it to plt-scheme 
> > first...)
> >
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> -=[ Jay McCarthy   http://jeapostrophe.github.io]=-
> -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
> -=[ Moses 1:33: And worlds without number have I created; ]=-



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Pretty display of tabular data?

2019-03-13 Thread Jay McCarthy
90% of the reason I made `raart` is because of this.

https://docs.racket-lang.org/raart/index.html#%28def._%28%28lib._raart%2Fdraw..rkt%29._table%29%29

(require raart
(draw-here (table (text-rows THE-TABULAR-DATA)))

Jay

On Wed, Mar 13, 2019 at 2:19 PM Matt Jadud  wrote:
>
> Hi all,
>
> I have a tabular data type that I'd like (I think) to be able to render it 
> either in ASCII or in a prettier way in the Interactions pane. I've explored 
> gen:write and friends, and can get the struct to display the way I 
> want---with ASCII. Essentially easy-peasy.
>
> What I wonder is: am I able to do something prettier? Can I encapsulate some 
> kind of styled rendering as a snip%, or... something... so that I can render 
> the first 5 and last 5 rows of a table with bolding of headers, etc.?
>
> I don't know where to start, essentially, if I wanted to try and do this. Or, 
> perhaps it is not particularly doable.
>
> Pointers to examples in codebases are welcome (if such examples exist), and I 
> can work from there. Or, indications that this might be really difficult are 
> also welcome.
>
> Cheers,
> Matt
>
> (Apologies if this somehow comes through twice... I sent it to plt-scheme 
> first...)
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] web-server/http documentation: "You are unlikely to need to construct a request struct." Why?

2019-02-20 Thread Jay McCarthy
On Wed, Feb 20, 2019 at 10:23 AM Marc Kaufmann
 wrote:
> I came across this statement regarding structure request in the 
> documentation: "You are unlikely to need to construct a request struct." (See 
> here.)
>
> Why does it say this? I want to generate requests (in one form or another) 
> for functional tests of my website. Should I use curl for that? And is the 
> rationale something to do with security?

What you want to do is basically the only use case for making
requests. That's why it says this. Sometime people think that they can
make request structures and use that with something like
net/http-client to make a request to a site. That's not what they are
for.

Jay

-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Package not updating after push?

2019-02-12 Thread Jay McCarthy
There was an internal error, but it is fixed now. Thanks!

On Mon, Feb 11, 2019 at 5:37 PM David Storrs  wrote:
>
> I've pushed some enhancements to the struct-plus-plus package but the
> package server is not picking them up.  I've updated the version
> number in info.rkt and I've done "Rescan all my packages" twice.  What
> should I do?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] sxml vs xexpr frustrations

2019-01-31 Thread Jay McCarthy
On Thu, Jan 31, 2019 at 1:56 AM Konrad Hinsen
 wrote:
> I actually migrated code from SXML to xexpr in order to be able to use
> Pollen.

For me, it feels like SXML is really optimized for consuming XML and
xexpr is really optimized for producing it.

Jay

-- 
-=[     Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] OpenGL in build w/ package server

2019-01-19 Thread Jay McCarthy
This page talks about foreign library on the package build:

https://pkg-build.racket-lang.org/about.html#foreign

It's plausible the GLU is something common enough, we should install
it by default.

On Sat, Jan 19, 2019 at 3:10 PM Matt Jadud  wrote:
>
> Hi all,
>
> Is there a way to convince the package server to build packages that rely on 
> the OpenGL bindings? Perhaps something in the deps of info.rkt that I don't 
> understand?
>
> raco setup:   ffi-lib: couldn't open "libGLU.so.1" (libGLU.so.1: cannot open 
> shared object file: No such file or directory)
>
> Cheers,
> Matt
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Issue about tcp port, server doesn't receive bytes using read-bytes-avail!* and client using write-bytes

2019-01-12 Thread Jay McCarthy
You need to flush-output

On Sat, Jan 12, 2019 at 10:55 AM Zhonghua Zhu 
wrote:

> I am writing a tcp server program.
> Server uses non-blocking reading and client uses write-bytes, then server
> never read any bytes and write-bytes returns the right value.
> But when I change client's write-bytes to write-bytes-avail, server
> receives bytes immediately.
>
> I don't know why this happens.
>
> It seems like (byte-ready? in) always returns false when client using
> write-bytes.
>
> Here is the server and client program.
>
> Server Program
>
> #lang racket
>
> (require racket/tcp)
>
> (define (prn-ln . args)
>   (displayln (apply format args)))
>
> (define server-listener #f)
> (define listen-port 8000)
>
> (set! server-listener (tcp-listen listen-port))
>
> (define in #f)
> (define out #f)
> (define bytes (make-bytes 4))
> (define len 0)
>
> (define (read-sock)
>   (when (and in
>  (byte-ready? in))
> (set! len (read-bytes-avail!* bytes in 0 4))
> (prn-ln "read len ~a" len)
> (prn-ln "read int ~a" (integer-bytes->integer bytes #f #f 0 4
>
> (define (game-loop)
>   (if (not in)
>   (when (tcp-accept-ready? server-listener)
> (set!-values (in out) (tcp-accept server-listener))
> (displayln "a new socket come in"))
>   (read-sock))
>   (sleep 1)
>   (game-loop))
>
> (game-loop)
>
> Client Program
>
> #lang racket
>
> (require racket/tcp)
>
> (define-values (in out) (tcp-connect "127.0.0.1" 8000))
>
> (define bytes (make-bytes 4))
> (define number 10)
> (integer->integer-bytes number 4 #f #f bytes 0)
>
> (define (loop)
>   (define ret (write-bytes bytes out 0 4))
>   (displayln (format "ret ~a" ret))
>   (sleep 1)
>   (loop))
>
> (loop)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] triggering servlet on GET parameters

2019-01-07 Thread Jay McCarthy
You can use web-server/servlet and you don't need to use
web-server/dispatch if you don't want to. Your design seems good to
me.

On Sun, Jan 6, 2019 at 10:33 AM Stephen De Gabrielle
 wrote:
>
> Thank you Jay and David,
>
> Your suggestions were good, #:servlet-regexp #rx"" lets me capture the 
> request for a page and server the original file, or the edit servlet:
> http://localhost:8000/mouse.html
> http://localhost:8000/mouse.html?action=edit
>
> I've been reading a little more and I think I've made a mistake!  I'm using 
> 'Stateful Servlets'(require web-server/servlet), and I *think* I should be 
> using (require web-server/dispatch), so I can  capture the situation where a 
> static file is not found.
>
> Do you think web-server/dispatch is the right approach?
>
> My design is;
>
> GET http(s)://server/
> -> serve static file at specified path
> GET http(s)://server/?action=edit
> -> serve edit page servlet that retrieves scribble source
> GET http(s)://server/
> -> serve edit page adding parameters ?action=edit or maybe new
> POST http(s)://server/
> -> update scribble source file,  generate target html file in 
> #:server-root-path and redirect to target html file at 
> http(s)://server/
>
>
>
> On Thu, Jan 3, 2019 at 4:35 PM David Storrs  wrote:
>>
>> Stephen, you might also find this useful as a reference to crib from: 
>> http://matt.might.net/articles/low-level-web-in-racket/
>>
>> On Thu, Jan 3, 2019 at 11:10 AM Jay McCarthy  wrote:
>>>
>>> Use normal racket/base and web-server/servlet-env ‘s serve/servlet
>>>
>>> On Thu, Jan 3, 2019 at 10:53 AM David Storrs  wrote:
>>>>
>>>>
>>>>
>>>> On Wed, Jan 2, 2019 at 7:12 PM Jay McCarthy  wrote:
>>>>>
>>>>> You need to stop using `web-server/insta`
>>>>
>>>>
>>>> What would you recommend he use instead of web-server/insta?
>>>>
>>>>>
>>>>> so you can customize more.
>>>>> Then, you need to intercept ALL requests with your servlet. Then, your
>>>>> servlet just needs to call (next-dispatcher) and the static file
>>>>> handler will kick in, because it comes after servlets.
>>>>>
>>>>> Jay
>>>>>
>>>>> On Wed, Jan 2, 2019 at 7:08 PM Stephen De Gabrielle
>>>>>  wrote:
>>>>> >
>>>>> > Hi,
>>>>> >
>>>>> > I'm fooling around with #lang web-server/insta, and I can serve .html 
>>>>> > files by setting (static-files-path page-root), but I'd like to trigger 
>>>>> > my servlet if there is a '?action=edit' parameter set.
>>>>> >
>>>>> > e.g
>>>>> > https://localhost/start.html just serves the file (I can do this!)
>>>>> > https://localhost/start.html?action=edit  calls my servlet (I can't 
>>>>> > work out how to do this :( )
>>>>> >
>>>>> > (There is a lot of documentation but I'm a beginner with webdev so 
>>>>> > don't know where to look)
>>>>> >
>>>>> > Kind regards
>>>>> >
>>>>> > Stephen
>>>>> >
>>>>> > PS the project is a scribble based wiki. If you create a new page you 
>>>>> > enter raw scribble/manual in a form (my servlet) and it gets saved in a 
>>>>> > folder and transformed into html that is served directly by 
>>>>> > (static-files-path page-root), the conversion from raw scribble goes 
>>>>> > like this:
>>>>> > (require raco/all-tools)
>>>>> > (define raco-scribble-spec (hash-ref (all-tools) "scribble"))
>>>>> > ;;scribble-to-html : source target body
>>>>> > ;; generate html file from scribble file
>>>>> > (define (scribble-to-html source target) ;-> list of strings
>>>>> >   (parameterize ([current-command-line-arguments (vector "--html" 
>>>>> > source)]
>>>>> >  [current-directory target])
>>>>> > (dynamic-require (cadr raco-scribble-spec) #f)))
>>>>> >
>>>>> >
>>>>> > --
>>>>> > 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 

Re: [racket-users] triggering servlet on GET parameters

2019-01-03 Thread Jay McCarthy
Use normal racket/base and web-server/servlet-env ‘s serve/servlet

On Thu, Jan 3, 2019 at 10:53 AM David Storrs  wrote:

>
>
> On Wed, Jan 2, 2019 at 7:12 PM Jay McCarthy 
> wrote:
>
>> You need to stop using `web-server/insta`
>
>
> What would you recommend he use instead of web-server/insta?
>
>
>> so you can customize more.
>> Then, you need to intercept ALL requests with your servlet. Then, your
>> servlet just needs to call (next-dispatcher) and the static file
>> handler will kick in, because it comes after servlets.
>>
>> Jay
>>
>> On Wed, Jan 2, 2019 at 7:08 PM Stephen De Gabrielle
>>  wrote:
>> >
>> > Hi,
>> >
>> > I'm fooling around with #lang web-server/insta, and I can serve .html
>> files by setting (static-files-path page-root), but I'd like to trigger my
>> servlet if there is a '?action=edit' parameter set.
>> >
>> > e.g
>> > https://localhost/start.html just serves the file (I can do this!)
>> > https://localhost/start.html?action=edit  calls my servlet (I can't
>> work out how to do this :( )
>> >
>> > (There is a lot of documentation but I'm a beginner with webdev so
>> don't know where to look)
>> >
>> > Kind regards
>> >
>> > Stephen
>> >
>> > PS the project is a scribble based wiki. If you create a new page you
>> enter raw scribble/manual in a form (my servlet) and it gets saved in a
>> folder and transformed into html that is served directly by
>> (static-files-path page-root), the conversion from raw scribble goes like
>> this:
>> > (require raco/all-tools)
>> > (define raco-scribble-spec (hash-ref (all-tools) "scribble"))
>> > ;;scribble-to-html : source target body
>> > ;; generate html file from scribble file
>> > (define (scribble-to-html source target) ;-> list of strings
>> >   (parameterize ([current-command-line-arguments (vector "--html"
>> source)]
>> >  [current-directory target])
>> > (dynamic-require (cadr raco-scribble-spec) #f)))
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "Racket Users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to racket-users+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> -=[ Jay McCarthy   http://jeapostrophe.github.io]=-
>> -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
>> -=[ Moses 1:33: And worlds without number have I created; ]=-
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] triggering servlet on GET parameters

2019-01-02 Thread Jay McCarthy
You need to stop using `web-server/insta` so you can customize more.
Then, you need to intercept ALL requests with your servlet. Then, your
servlet just needs to call (next-dispatcher) and the static file
handler will kick in, because it comes after servlets.

Jay

On Wed, Jan 2, 2019 at 7:08 PM Stephen De Gabrielle
 wrote:
>
> Hi,
>
> I'm fooling around with #lang web-server/insta, and I can serve .html files 
> by setting (static-files-path page-root), but I'd like to trigger my servlet 
> if there is a '?action=edit' parameter set.
>
> e.g
> https://localhost/start.html just serves the file (I can do this!)
> https://localhost/start.html?action=edit  calls my servlet (I can't work out 
> how to do this :( )
>
> (There is a lot of documentation but I'm a beginner with webdev so don't know 
> where to look)
>
> Kind regards
>
> Stephen
>
> PS the project is a scribble based wiki. If you create a new page you enter 
> raw scribble/manual in a form (my servlet) and it gets saved in a folder and 
> transformed into html that is served directly by (static-files-path 
> page-root), the conversion from raw scribble goes like this:
> (require raco/all-tools)
> (define raco-scribble-spec (hash-ref (all-tools) "scribble"))
> ;;scribble-to-html : source target body
> ;; generate html file from scribble file
> (define (scribble-to-html source target) ;-> list of strings
>   (parameterize ([current-command-line-arguments (vector "--html" source)]
>  [current-directory target])
> (dynamic-require (cadr raco-scribble-spec) #f)))
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Implications of stateless servlets & how/whether to avoid them

2018-12-03 Thread Jay McCarthy
On Fri, Nov 30, 2018 at 9:43 PM Brian Adkins  wrote:
> Using the lift dispatcher directly didn't feel quite right, so I'll look into 
> dispatch/servlet. Will dispatch/servlet spin up a thread for each request as 
> serve/servlet does? If so, that will save me from handling the request 
> threading myself. I don't think I need a stuffer or manager though, so I'm 
> not sure dispatch/sev

The one thread per request rule happens at a lower level in the heart
of the Web server.

> I don't know if the Racket web server (or related libraries) currently 
> provide a way to stream data in the response, but that is something I'll 
> definitely need relatively soon (primarily for streaming large CSV/JSON 
> files). If it doesn't exist, I don't mind writing it, but I also don't want 
> to begin with an approach now that might make adding that capability more 
> difficult later. From my brief research, given the output field of the 
> response struct is a lambda, I think I can stream using that (i.e. return a 
> lambda in the response immediately that begins writing the data as it 
> retrieves it) - hopefully the infrastructure doesn't buffer the entire 
> output. Other than something like that, I'm happy to work mostly at the level 
> of functions from requests to responses.

The reason why responses have the lambda rather than a byte string is
specifically for streaming like you want. Make sure you specify the
correct response size in the headers.

> I will need full control over the URL, and I thought I read somewhere that 
> some servlets needed to use the URL for state in some cases. That wouldn't 
> work for me.

`send/suspend` may use the URL(*) for state, but that is it. There's
no other part of the Web server that forces your URL in any way.

> I'm confused about your statement, "...make it easy to do stuff like encrypt 
> and sign the state you store on the clients". I would think encrypting and 
> signing something would be simple function calls unrelated to whether I'm 
> using servlets or not. Is this not the case? My client-side state needs are 
> minimal - typically a session ID is sufficient. I wasn't aware of 
> functionality built-in to the web server for this, so I just assumed I would 
> have a secret key on the server that I'd use to encrypt state. I haven't 
> gotten that far yet.

When `send/suspend` manipulates the URL (*or a POST parameter) to
store the state of your program, then you are storing information on
the client. That information is therefore susceptible to attack or
manipulation. The Web server gives you a simple way to either sign or
encrypt that information transparently, so that it is always done and
you never forget.

Jay

> On Friday, November 30, 2018 at 8:25:40 PM UTC-5, Jay McCarthy wrote:
>>
>> Hi Brian,
>>
>> I think you are misunderstanding what that section is about. It is
>> just describing how the system is implemented.  There's basically
>> nothing in there that you need to know as user other than "It may take
>> a while to compile." For instance, you don't worry about the fact that
>> all tree-like functions in your normal Racket code are eventually
>> turned into linear sequences of assembly. Those changes to your code
>> discussed in 3.2 are things that happen in the compiler, you don't
>> need to do anything, just like you don't need to think about register
>> allocation when you write normal programs, but it happens behind the
>> scenes.
>>
>> Nothing described in section 3 happens to your code unless you write
>> in `#lang web-server` or `#lang web-server/base`. You can use or not
>> use continuations and use or not use this library... they are totally
>> orthogonal. There is basically no program that you can write in one
>> that you can't write in the other, as long as you call the appropriate
>> version of `send/suspend`.
>>
>> The whole point of this library is to write code as-if it were
>> stateful, but the compiler automatically makes it stateless. If you
>> are comfortable programming directly with inverted control, then go
>> right ahead and implement the stateless stuff yourself. Both ways are
>> going to be equally efficient, although the `#lang web-server` library
>> will be guaranteed to do it correctly and make it easy to do stuff
>> like encrypt and sign the state you store on the clients.
>>
>> As far as using `serve/servlet` or not, the implementation of it is
>> really simple [1] in case you want to adapt it. I don't recommend
>> using the lift dispatcher directly. You probably want to use
>> `dispatch/servlet`. Remember, in Racket, a servlet is just a function
>> from request to response, with some resource control. It doesn't
>> im

Re: [racket-users] Implications of stateless servlets & how/whether to avoid them

2018-11-30 Thread Jay McCarthy
Hi Brian,

I think you are misunderstanding what that section is about. It is
just describing how the system is implemented.  There's basically
nothing in there that you need to know as user other than "It may take
a while to compile." For instance, you don't worry about the fact that
all tree-like functions in your normal Racket code are eventually
turned into linear sequences of assembly. Those changes to your code
discussed in 3.2 are things that happen in the compiler, you don't
need to do anything, just like you don't need to think about register
allocation when you write normal programs, but it happens behind the
scenes.

Nothing described in section 3 happens to your code unless you write
in `#lang web-server` or `#lang web-server/base`. You can use or not
use continuations and use or not use this library... they are totally
orthogonal. There is basically no program that you can write in one
that you can't write in the other, as long as you call the appropriate
version of `send/suspend`.

The whole point of this library is to write code as-if it were
stateful, but the compiler automatically makes it stateless. If you
are comfortable programming directly with inverted control, then go
right ahead and implement the stateless stuff yourself. Both ways are
going to be equally efficient, although the `#lang web-server` library
will be guaranteed to do it correctly and make it easy to do stuff
like encrypt and sign the state you store on the clients.

As far as using `serve/servlet` or not, the implementation of it is
really simple [1] in case you want to adapt it. I don't recommend
using the lift dispatcher directly. You probably want to use
`dispatch/servlet`. Remember, in Racket, a servlet is just a function
from request to response, with some resource control. It doesn't
impose any programming style or other costs on you. I get the
impression from your comments that you are really nervous about some
sort of costs imposed by using Racket libraries and think you will get
some benefit by being "low-level". This is probably misguided and just
based on some misunderstandings.

Jay

1. 
https://github.com/racket/web-server/blob/master/web-server-lib/web-server/servlet-env.rkt#L156

On Fri, Nov 30, 2018 at 4:30 PM Brian Adkins  wrote:
>
> I could be misreading the information in "3.2 Usage Considerations", but it 
> seemed like the modifications to my program were automatic, but maybe that 
> only happens when using #lang web-server or #lang web-server/base ?
>
> Regardless, I'm wondering if maybe I should just use (serve) instead of 
> (serve/servlet) since I'll likely be working at that level later anyway. In 
> that case, it looks like dispatch-lift:make is the main thing I need to get 
> things rolling. As a simple example:
>
> #lang racket
> (require web-server/web-server)
> (require web-server/http/response-structs)
> (require (prefix-in log: web-server/dispatchers/dispatch-log))
> (require (prefix-in lift: web-server/dispatchers/dispatch-lift))
> (require (prefix-in seq: web-server/dispatchers/dispatch-sequencer))
> (require (prefix-in stat: web-server/dispatchers/dispatch-stat))
>
> (define (controller request)
>   (response
>200
>#"OK"
>(current-seconds)
>TEXT/HTML-MIME-TYPE
>empty
>(λ (op) (write-bytes #"Hello, World!" op
>
> (serve
>  #:dispatch (seq:make (log:make #:format log:extended-format
> #:log-path "development.log") ; log request
>   (stat:make) ; print memory usage
>   (lift:make controller))
>  #:port 8080)
>
> To be clear, it's not just continuations that I want to avoid, I'd also like 
> to avoid the changes that are described in section 3.2 above.
>
>
> On Friday, November 30, 2018 at 3:20:39 PM UTC-5, Jay McCarthy wrote:
>>
>> There's nothing wrong with ignoring the continuation support in the
>> Web server, either the native ones or stateless ones. If you do, I
>> recommend using something like `create-none-manager` [1]  as the
>> `#:manager` argument to `serve/servlet` so that you don't accidentally
>> start using them. The "too far" line is that you can't use
>> `send/suspend`. In the web-server/servlet/web [2] module, you just
>> want to use `send/back` and `with-errors-to-browser`, and no other
>> functions.
>>
>> Jay
>>
>> 1. 
>> https://docs.racket-lang.org/web-server/servlet.html?q=none-manager#%28def._%28%28lib._web-server%2Fmanagers%2Fnone..rkt%29._create-none-manager%29%29
>> 2. 
>> https://docs.racket-lang.org/web-server/servlet.html?q=send%2Fsuspend#%28part._web%29
>> On Fri, Nov 30, 2018 at 2:17 PM Brian Adkins  wrote:
>> >
>> > A while ago, I read Jay's response

Re: [racket-users] Implications of stateless servlets & how/whether to avoid them

2018-11-30 Thread Jay McCarthy
There's nothing wrong with ignoring the continuation support in the
Web server, either the native ones or stateless ones. If you do, I
recommend using something like `create-none-manager` [1]  as the
`#:manager` argument to `serve/servlet` so that you don't accidentally
start using them. The "too far" line is that you can't use
`send/suspend`. In the web-server/servlet/web [2] module, you just
want to use `send/back` and `with-errors-to-browser`, and no other
functions.

Jay

1. 
https://docs.racket-lang.org/web-server/servlet.html?q=none-manager#%28def._%28%28lib._web-server%2Fmanagers%2Fnone..rkt%29._create-none-manager%29%29
2. 
https://docs.racket-lang.org/web-server/servlet.html?q=send%2Fsuspend#%28part._web%29
On Fri, Nov 30, 2018 at 2:17 PM Brian Adkins  wrote:
>
> A while ago, I read Jay's response about how to use the Racket web server w/o 
> continuations here:
>
> https://groups.google.com/forum/#!msg/racket-users/bTBj-RbMLDA/k80HNazuFAAJ
>
> At the time, I didn't dig very deeply into it and just assumed avoiding 
> web-server/servlet would be sufficient, but I just read through the 
> documentation on stateless servlets here:
>
> https://docs.racket-lang.org/web-server/stateless.html
>
> In particular, section 3.2, where it states things like:
>
> "All uses of letrec are removed and replaced with equivalent uses of let and 
> imperative features."
>
> "The program is defunctionalized with a serializable data-structure for each 
> lambda"
>
> "First, this process drastically changes the structure of your program. It 
> will create an immense number of lambdas and structures your program did not 
> normally contain. The performance implication of this has not been studied 
> with Racket."
>
> It seems like there is quite a bit of stuff going on to support continuations 
> with stateless servlets. Since I'm not planning on using continuations at 
> all, I'm not sure I want the changes to my code described in section 3.2.
>
> I'm coming from an entirely stateless architecture w/ Ruby/Rails, and I was 
> planning on using a similar style w/ Racket, so I'm just trying to get a feel 
> for how low in the stack I need to be to avoid the extra functionality that I 
> don't want/need. Eventually, I'm planning on resuming work on a web app 
> framework in Racket that steals my favorite things from Rails & other 
> frameworks, and leaves out the cruft. For that, I expect I'll need to base my 
> code on lower levels, but for my current app, I don't have time to create too 
> much infrastructure, so I'd like to leverage basic things from built-in 
> Racket functionality without going "too far", and I'm not even able to 
> articulate well where the "too far" line is.
>
> Thanks,
> Brian
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] What is the expected PLT package catalog refresh rate? Is it not refreshing now?

2018-11-19 Thread Jay McCarthy
That error means, "The package server knows about this package but
never got a checksum, so I'm giving up." It would be fixed once the
server updates (which I just noticed it do after I kicked it for
Kramer)

Jay
On Mon, Nov 19, 2018 at 11:47 AM David Storrs  wrote:
>
> I tried to install it and got this:
>
> $ raco pkg install plisqin
> Resolving "plisqin" via 
> https://download.racket-lang.org/releases/6.11/catalog/
> Resolving "plisqin" via https://pkgs.racket-lang.org
> raco pkg install: cannot use empty checksum for Git repostory package source
>   source: https://github.com/default-kramer/plisqin.git
>
> You can force a refresh by going to the top-right corner where your name is, 
> click that, and then choose "re-scan all my packages".
>
>
>
> On Sun, Nov 18, 2018 at 8:03 PM  wrote:
>>
>> I've just uploaded a package to the PLT catalog: 
>> https://pkgd.racket-lang.org/pkgn/search?tags=author%3Adefault.kramer%40gmail.com
>>
>> But I don't think it is refreshing? It tells me "This package has been 
>> modified since the package index was last rebuilt. The next index refresh is 
>> scheduled for Monday, November 19th, 2018 12:58:07am (UTC)."
>>
>> It always says the next refresh is less than 5 minutes away. But the message 
>> remains.after waiting 5 or more minutes.
>>
>> (Other clues that make me think it is not refreshing: PLT tells me "This 
>> package needs documentation" even though it has documentation. And "raco pkg 
>> install plisqin" finds nothing.)
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


[racket-users] Racket Weet 2019

2018-11-14 Thread Jay McCarthy
Racket Week
8-14 July 2019
https://con.racket-lang.org/2019/

We're have a week of Racket in summer 2019:
- How to Design Languages (5 day intensive from 8th to 12th)
- Beautiful Racket Workshop (3 day gentle from 10th to 12th)
- RacketCon on 13th
- RacketCon Office Hours on 14th

Save the date!

Jay

-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Re: how to make a cartesian supergenerator?

2018-10-21 Thread Jay McCarthy
I think the best strategy would be to convert the generator to a
sequence and then the sequence to a stream, then write a stream
cartesian product. The stream will cache the results of the generator.
On Sun, Oct 21, 2018 at 4:58 PM Matthew Butterick  wrote:
>
> I suppose just putting in a hash isn't too bad.
>
> #lang racket
> (require racket/generator rackunit)
>
> (define/contract (make-cartesian-generator gens)
>   ((listof generator?) . -> . generator?)
>   (generator ()
>  (define solcache (make-hasheqv))
>  (let loop ([gens gens][genidx 0][sols empty])
>(cond
>  [(empty? gens) (yield (reverse sols))]
>  [else
>   (match-define (cons gen rest) gens)
>   (cond
> [(eq? (generator-state gen) 'done)
>  (for ([sol (in-list (reverse (hash-ref solcache 
> genidx)))])
>(loop rest (add1 genidx) (cons sol sols)))]
> [else
>  (for ([sol (in-producer gen (void))])
>(hash-update! solcache genidx (λ (vals) (cons sol 
> vals)) null)
>(loop rest (add1 genidx) (cons sol sols)))])]
>
> (define g1 (generator () (yield 1) (yield 2) (void)))
> (define g2 (generator () (yield 'a) (yield 'b) (void)))
>
> (check-equal?
>  (for/list ([gs (in-producer (make-cartesian-generator (list g1 g2)) (void))])
>gs)
>  '((1 a) (1 b) (2 a) (2 b)))
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] servlet development in REPL

2018-10-03 Thread Jay McCarthy
You'd have to build it yourself, by doing a `set!` in the REPL to
inject the new function in.
On Wed, Oct 3, 2018 at 8:10 AM Cam  wrote:
>
>
> I am playing around with the built-in webserver functionality with
> `servlet/serve' and am wondering if there is a way to automatically
> "reload" the servlet, for lack of better terminology, when I am playing
> in the REPL. In other words, if I do something like this in the REPL:
>
> (define (about-page req)
>   (response/xexpr
>'(html (body (h1 "about")
>
> (define-values (dispatch handler->url)
>   (dispatch-rules
>[("about") about-page]))
>
> (serve/servlet
>  #:port 8088
>  #:listen-ip #f
>  #:servlet-path "/"
>  #:servlet-regexp #px".*"
>  dispatch)
>
> ...and then redefine `about-page' like this:
>
> (define (about-page req)
>   (response/xexpr
>'(html (body (h1 "something else")
>
> ...I would like to refresh my browser on the `/about' page and see
> "something else" instead of "about".
>
> Is there some way to achieve this?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] with-syntax, format-id, and ellipses

2018-09-28 Thread Jay McCarthy
The upcoming ~indexed form would make this easier, I think ---
https://github.com/racket/racket/pull/2262

But for now, you'll need to expand it yourself a bit. Line 26 would be

[constructors
 (for/list ([o (in-list (syntax->list #'(fs.o ...)))])
   (format-id #'name "create-~a-~a" #'name o))]

On Fri, Sep 28, 2018 at 2:21 PM, Dan Liebgold  wrote:
> Hi,
>
> I'm trying to use with-syntax to create a series of new identifiers by
> breaking apart syntax and gluing bits together using format-d, but I can't
> get the ellipses syntax quite right.
>
> Here's my code:
>
>   http://pasterack.org/pastes/81271
>
> Line 26 contains the issue... I can't get the format-id expression to repeat
> properly.
>
> Thanks for any assistance!
> 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.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


[racket-users] (eighth RacketCon) in St. Louis on September 29th & 30th - Early registration ends next week

2018-08-31 Thread Jay McCarthy
Remember that

(eighth RacketCon) in St. Louis on September 29th & 30th

http://con.racket-lang.org

The early registration will end week.

http://con.racket-lang.org

The schedule of speakers and events is up.

http://con.racket-lang.org

We hope to see you all there! Tell your friends!

http://con.racket-lang.org

Jay

-- 
-=[     Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-

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


Re: [racket-users] Announcing Event-lang

2018-05-21 Thread Jay McCarthy
This is very cute! Can you point to a fun example? I looked through
the repo and it wasn't obvious where some tests and examples were.

Jay

On Fri, May 18, 2018 at 4:20 PM, Eric Griffis <ded...@gmail.com> wrote:
> Hi everyone,
>
> I would like to announce the initial release of event-lang, an
> experimental Racket library that simplifies the creation of complex
> synchronizable events.
>
> https://pkgd.racket-lang.org/pkgn/package/event-lang
>
> Event-lang provides a primitive expression lifting form,
>
>   > (pure 123)
>   #
>
> some event combinators,
>
>   > (sync (fmap + (pure 1) (pure 2)))
>   3
>   > (sync (app (pure +) (pure 1) (pure 2)))
>   3
>   > (sync (bind (pure 1) (pure 2) (λ xs (pure (apply + xs)
>   3
>
> and a collection of event-friendly alternatives to base Racket forms
> and functions.
>
>   > (sync
>  (event-let
>   ([x (pure 1)]
>[y (pure 2)])
>   (pure (list x y
>   '(1 2)
>
> Composite events make progress by synchronizing constituent events,
> either concurrently or in a predictable sequence. Synchronization
> results can be ordered as specified,
>
>   > (let ([t0 (current-inexact-milliseconds)])
>   (define (now) (- (current-inexact-milliseconds) t0))
>   (sync
>(async-args
> (pure (cons 1 (now)))
> (pure (cons 2 (now)))
> (pure (cons 3 (now))
>   '(1 . 0.200927734375)
>   '(2 . 0.14990234375)
>   '(3 . 0.178955078125)
>
> or as completed.
>
>   > (let ([t0 (current-inexact-milliseconds)])
>   (define (now) (- (current-inexact-milliseconds) t0))
>   (sync
>(async-set
> (pure (cons 1 (now)))
> (pure (cons 2 (now)))
> (pure (cons 3 (now))
>   '(2 . 0.0771484375)
>   '(3 . 0.093017578125)
>   '(1 . 0.123046875)
>
> The project has three outstanding objectives:
>
> 1. Provide a sophisticated lifting form
>
>   to simplify usage of the provided constructs. The event/event module
>   contains a first approximation. Its construction was tedious and
>   error prone, so I commented out the docs.
>
> 2. Provide a full-blown #lang event/racket/base
>
>   for producing whole modules of events and event constructors from
>   ordinary Racket code in a principled manner.
>
> 3. Provide support for static analysis of synchronization behaviors.
>
>   Event programming in Racket is a curious form of meta-programming,
>   and a few simple compile-time checks could reduce cognitive
>   overhead.
>
> This pre-release is a request for feedback in anticipation of a
> production-ready version 1.0. I would like to round out the base
> collection and devise a comprehensive testing plan, with a stretch
> goal of re-introducing the sophisticated lifting form. At the moment,
> I'm using event-lang daily and adding base constructs as needed. Feel
> free to do the same or request your favorites.
>
> Please take a look and let me know what you think.
>
> Eric
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Search the Racket package catalog on the command line

2018-05-21 Thread Jay McCarthy
There is not a better way. I often use links.

Jay

On Sun, May 20, 2018 at 8:03 PM, Winston Weinert <winston+...@ml1.net> wrote:
> Is there a way to search the Racket package catalog from the command line?
>
> I found "raco pkg catalog-show --all" lists all entries, but it appears to
> take some time, and requires some extra processing to search by name
> properly (such as using a script to parse by entry, and match against the
> name field, and show matches).
>
> Is there a better way?
>
> Thanks,
> Winston Weinert
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Re: RacketCon 2018 Website

2018-04-20 Thread Jay McCarthy
On Sat, Apr 21, 2018 at 1:07 AM, Greg Hendershott
<greghendersh...@gmail.com> wrote:
> 0. Another consideration with the ASCII art font is that it won't get
> indexed by search engines. This doesn't matter so much for the first
> three, since the same info is in the page . But it means
> searching for "Kent Dybvig" won't turn up this page.

I think that someone with more CSS pizazz than me could put something in this

line 
https://github.com/racket/racket-lang-org/blob/master/rcon/2018/pollen.rkt#L117

and then in the CSS to put the text directly in there but hide/show it
with certain media-types.

> 1. The "organizers" href is "http://mailto:jay.mccar...@gmail.com; --
> which on some browsers opens gmail.com. I think
> "mailto:jay.mccar...@gmail.com; was meant.

I think this is an error in Pollen or maybe an error in Jay. The code is

◊link["mailto:jay.mccar...@gmail.com"]{organizers}

-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] How to obtain the public IP of the sender of an HTTP request?

2018-04-17 Thread Jay McCarthy
request-client-ip on the request object your handler gets.

Jay

On Tue, Apr 17, 2018 at 2:54 PM, David Storrs <david.sto...@gmail.com> wrote:
> Assume I'm a web server and one of the requests I want to respond to
> is "What is my public IP address?"  More specifically, if the server
> receives an HTTP request to, let's say, the ".../get-ip" endpoint then
> it should send back an HTTP response containing the sender's public
> IP.  cf https://www.ipchicken.com/ for a real example.
>
> This information is available in the IP connection data
> (https://en.wikipedia.org/wiki/IPv4#Source_address) but I'm not sure
> how to get access to that from within the web-server/* packages.  I've
> been wikiwalking through the docs and am coming up empty.
>
> I'm starting a pretty vanilla server like so:
>
> (define-values (dispatch-request url-for)
>   (dispatch-rules
> ...stuff...
> ))
>
>   (serve/servlet dispatch-request
>  #:launch-browser? #f
>  #:servlet-regexp #px""
>  #:listen-ip #f
>  #:port (port-num)
>  #:log-file log-path
>  )
>
> I recognize that the Source Address in the packet can and probably
> will be changed when it runs through a NAT layer, but that's
> acceptable in my use case.
>
> Any pointers?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] deprecating a package (and redirecting users to new version)

2018-04-13 Thread Jay McCarthy
You can add the `deprecated` tag and change the description.

Jay

On Thu, Apr 12, 2018 at 5:13 PM, Stephen De Gabrielle
<spdegabrie...@gmail.com> wrote:
> Hi,
>
> What is the best way to deprecate a package on pkgs.racket-lang.org ?
>
> Is there a way to redirect users to a new package (with a different name)?
>
> Kind regards,
>
> Stephen
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


[racket-users] (eighth RacketCon) is St. Louis in September 2018

2018-03-28 Thread Jay McCarthy
Prepare yourselves!

(eighth RacketCon) is St. Louis in September 2018!

http://con.racket-lang.org

co-located with ICFP and Strange Loop!

--

At this point, you can book your hotel room (get them fast!) and let
me know what you plan on presenting!

Jay

-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Another pkgs badge improvement, re needing documentation

2018-03-26 Thread Jay McCarthy
I agree that such a tool would be very useful and awesome. One
coherent thing might be a way to create a piece of data in the info
file that lists which modules & collections go in which packages in a
"virtual" way and have them split by "raco pkg", then extend that
language with the ability to splice out a submodule.

(A goal of mine in the past, in a very early version of the new
package system, was a way to hide whether a module like A/B/C was in
the file "A/B/C.rkt" or whether it was actually submodule C of
submodule B of module A. If you had that, then Racket source files and
bytecode would be like their own archive/JAR-like format.)

Jay

On Mon, Mar 26, 2018 at 4:21 PM, Greg Hendershott
<greghendersh...@gmail.com> wrote:
> p.s. The work to do this, has to be worth it if only for the resulting
> paper title: "You Want When Where?"
>
> On Mon, Mar 26, 2018 at 4:16 PM, Greg Hendershott
> <greghendersh...@gmail.com> wrote:
>> It's a shame because Racket has such a wonderful story for test and
>> srcdoc submodules.
>>
>> You're not forced to segregate each kind of thing in fussy
>> subdirectories. On the contrary, if you want, you can even mix them
>> within the same source file. Having that choice for projects is nice!
>> Losing it for "split" packages... isn't nice.
>>
>> It's especially a shame for smaller packages. More ceremonial busywork
>> external to the language, seems un-Rackety.
>>
>> raco test knows how to find the test files and submodules. I wish it
>> weren't so difficult for raco pkg to figure out how to extract the
>> run-, test-, and doc-time parts, and handle the bureaucracy for the
>> package catalog.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Another pkgs badge improvement, re needing documentation

2018-03-26 Thread Jay McCarthy
On Mon, Mar 26, 2018 at 3:11 PM, Neil Van Dyke <n...@neilvandyke.org> wrote:
> Philip McGrath wrote on 03/26/2018 02:15 PM:
>>
>>  "foo"/"foo-lib"/"foo-doc"/"foo-test" package groups, which seem to be a
>> prominent part how the Racket package system is used in practice.
>
>
> Is a convention of breaking up code packages into separate lib/doc/test
> packages a good thing, or is it usually done because (theories):
>
> 1. people saw it mentioned in package system docs, and/or saw an example of
> it, and assumed it was a recommended practice;

I assume that people do it because they see the team that produces
DrRacket, the GUI, etc doing it.

> 2. it is to mitigate actual space/time problems (e.g., "I don't want to
> build docs when I deploy", "I don't want to compile anything on my little
> router") that could better be handled by the right simple tools support,
> while keeping the packages and package model clean and simple; or

It is necessary to make "minimal" packages and to have a "minimal"
install. I think the main use case is that documentation is likely to
include a picture, which will be generated by plot or one of the many
drawing systems, and then including documentations means that a
headless server now needs all the GUI tools.

> 3. there is perceived pressure from large and monolithic packages (e.g., a
> small use ends up working with lots of linearly-scaled bytes of package, and
> the documentation portion of those bytes is wrongly blamed, rather than the
> sheer amount of code stuff), but some of those monolithic packages might
> better be decomposed into smaller and more flexible topical packages (rather
> than lib/doc/test)?

My opinion is that many existing packages can be divided up in the way
you suggest.

> Just checking that this is on the best practical path, since, in some
> regards, we aren't stuck legacy like some are.  The Racket package system
> was redone from scratch rather recently, and not saddled with 25 years of
> engineering debt like some other packages systems for distros and languages.
> We also have the advantage that code in Racket packages can use the
> flexibility of the language for modularity purposes that otherwise might put
> more burden on a package system.  We still have opportunity to have the
> package system be fairly clean and simple, and to save the rare
> bulk/complexity for high-value features (e.g., versioning, stripping).

My original hope was that we could have tools to automatically produce
test-less/doc-less/etc-less editions of packages from a single source,
but figuring out what to include/not-include is pretty hard in Racket
and it turns out that making these sorts of separating decisions by
the author is pretty much exactly what the package system provides
for.

Jay

-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Another pkgs badge improvement, re needing documentation

2018-03-26 Thread Jay McCarthy
We talked about this issue when the badges were added but could not
come to an agreement about how to do it

https://github.com/tonyg/racket-pkg-website/issues/58

In particular, you can see the commit that Conor Finegan made to
implement part of the idea that was rejected.

Jay

On Sun, Mar 25, 2018 at 5:49 PM, Philip McGrath
<phi...@philipmcgrath.com> wrote:
> While we're (sort of) on the subject of badges on pkgs.racket-lang.org: the
> "This package needs documentation" badge is mostly great, both as a producer
> and consumer of packages.
>
> I've encountered at least two types of cases, though, where packages may
> intentionally and justifiably lack documentation (or at least not have it in
> a form that pkgs.racket-lang.org can recognize):
>
> Packages that are split up into "foo"/"foo-lib"/"foo-doc"/"foo-test". The
> server doesn't know that "foo-doc" documents "foo-lib", so packages like
> "foo-lib" get the "needs documentation" badge. For example, "gui-lib" gets
> the badge.
> Packages that just distribute platform-specific native binaries, like
> "ffmpeg-x86_64-win32". It's a bit more complicated in this case to
> generalize where the documentation is, and it is certainly at least arguable
> that there should be some sort of documentation of the existence and purpose
> of such packages, but it would probably be very silly to give each one its
> own "scribblings/ffmpeg-x86_64-win32.scrbl" as the package server expects.
>
> Giving these kinds of packages the "This package needs documentation" badge
> seems less than ideal for package consumers: I'm probably not the only one
> who avoids depending on undocumented packages. Most of the time, of course,
> it isn't too confusing given a moment's thought (assuming one knows the
> -lib/-doc/-test convention and/or the maintainer filled in the "description"
> field), though there do seem to be some native binary packages that are not
> obviously linked to their client package(s), but even a momentary
> stop-and-think impedes quickly scanning or programmatically filtering the
> search results.
>
> There's another downside for package maintainers, which is that these show
> up as "todos". While, again, maintainers probably don't have to think much
> about it when they actually review them, the existence of
> intentional/expected "todos" prevents maintainers from applying the simple
> rule that nonzero "todos" always means there's something they should go and
> fix.
>
> I think the most useful resolution would be to give package maintainers a
> way to specify that some package documents or is documented by some other
> package (or possibly some arbitrary URL—I would have reservations about that
> approach, but it seems worth considering whether it might be useful for the
> case of native binary packages). Other options I can imagine, like adding a
> way to just suppress the badge, seem less good in that they would weaken the
> badge system.
>
> This is a post and not a pull request because it seems like there are a lot
> of details that would need to be agreed upon, and I'm not sure I know the
> right answers or all of the non-obvious implications. (For example, should
> the documented package point to the documenting package, or vice versa, or
> should both packages have to "agree" on the relationship?) If consensus
> emerges, though, I would be happy to contribute some implementation effort!
> (Eventually …)
>
> -Philip
>
> On Sun, Mar 25, 2018 at 1:02 PM, 'John Clements' via Racket Users
> <racket-users@googlegroups.com> wrote:
>>
>> I’m fixing problems related to documentation on the libgit2 package, and
>> it appears there are a number of issues to fix, but the first one was that
>> the package was written with a main scribblings file called “manual.scrbl”.
>> It turns out this is a bad idea, and in fact this is mentioned in the raco
>> documentation, and there’s a helpful “conflicts” file that appears in the
>> “Most Recent Build Results.” (Unfortunately, I didn’t find this until I’d
>> already figured out this part of the problem.) My question is this; have we
>> given any thought to adding a conflict notification—either a badge or an
>> entry in the green box—to the front pkgs.racket-lang.org page?
>>
>> Apologies if there’s some good reason this isn’t already a thing.
>>
>> John
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop rec

Re: [racket-users] "conflicts" badge for pkgs page?

2018-03-26 Thread Jay McCarthy
Thanks for the suggestion. I thought I already did this, but didn't. I
just added it.

On Sun, Mar 25, 2018 at 1:02 PM, 'John Clements' via Racket Users
<racket-users@googlegroups.com> wrote:
> I’m fixing problems related to documentation on the libgit2 package, and it 
> appears there are a number of issues to fix, but the first one was that the 
> package was written with a main scribblings file called “manual.scrbl”. It 
> turns out this is a bad idea, and in fact this is mentioned in the raco 
> documentation, and there’s a helpful “conflicts” file that appears in the 
> “Most Recent Build Results.” (Unfortunately, I didn’t find this until I’d 
> already figured out this part of the problem.) My question is this; have we 
> given any thought to adding a conflict notification—either a badge or an 
> entry in the green box—to the front pkgs.racket-lang.org page?
>
> Apologies if there’s some good reason this isn’t already a thing.
>
> 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.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] How often does the package server check for updates?

2018-03-07 Thread Jay McCarthy
Yup

On Wed, Mar 7, 2018 at 6:39 PM, David Storrs <david.sto...@gmail.com> wrote:
> Thanks.
>
> Dave
>
> PS  "check for updates"  is the "rescan my packages" item from the profile
> menu, right?
>
> On Wed, Mar 7, 2018 at 5:01 PM, Jay McCarthy <jay.mccar...@gmail.com> wrote:
>>
>> It checks hourly, or when you press the check for updates button.
>>
>>
>> --
>> -=[ Jay McCarthy   http://jeapostrophe.github.io]=-
>> -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
>> -=[ Moses 1:33: And worlds without number have I created; ]=-
>
>



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] How often does the package server check for updates?

2018-03-07 Thread Jay McCarthy
It checks hourly, or when you press the check for updates button.


-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] pkgd.racket-lang.org sign-in link down

2018-03-04 Thread Jay McCarthy
Thanks, I just kicked it.

On Sun, Mar 4, 2018 at 9:04 PM, 'John Clements' via users-redirect
<us...@plt-scheme.org> wrote:
> The “sign in” link on pkgs.racket-lang.org appears to time out. It looks to 
> me like that’s because it’s a link to pkgd.racket-lang.org (not pkgs….). I 
> believe these are … supposed to be synonyms? When I go to 
> pkgd.racket-lang.org I get a directory listing… looks like a misconfigured 
> web server.
>
> 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.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] big-bang + right click?

2018-02-17 Thread Jay McCarthy
FWIW Stephen, I have another package called `lux` that tries to be a
"professional" big-bang and it supports stuff like this.

The documentation is here: http://docs.racket-lang.org/lux/index.html

But I suggest checking out the two examples first.

val-demo --- 
https://github.com/jeapostrophe/lux/blob/master/examples/val-demo.rkt
--- Shows how you can use 2htdp/image or pict to make your scenes and
it shows how the generic event-handler receives key events from
racket/gui.

spin --- https://github.com/jeapostrophe/lux/blob/master/examples/spin.rkt
--- is a little more complicated and shows how you get mouse event
structures as well as demonstrating that lux can be used recursively.
[For comparison, if you call big-bang inside a big-bang handler, then
a new window opens up. In lux, the same window is taken over and the
result from the inner call is returned to the call site. This can be
used to make things like pause screens, menus, and so on fairly
nicely.]

Jay

-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Datalog Question

2018-01-31 Thread Jay McCarthy
Something like

kevin(Y) :- foo(x, Y), Y != 3.
kevin(Y)?





On Wed, Jan 31, 2018 at 5:13 PM, Kevin Forchione <lyss...@gmail.com> wrote:
> Can anyone tell me how I would use the datalog = and != tokens? The 
> documentation says they can separate terms, such as  != . In the 
> program below, how would I create a query for foo(x, ?) where ? is not 3?
>
> #lang datalog
>
> foo(bil, 1).
> foo(bob, 3).
> foo(joe, 2).
>
> I imagine I’d have to create a rule of some sort.
>
> -Kevin
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Lessons learned from writing a Conway's Game of Life implementation in big-bang

2018-01-05 Thread Jay McCarthy
gt;
> > Obviously there's "the most correct" optimization to do, given that I've
> > already gone down the route of committing imperative-rendering sins: I
> > ought to keep around the previous graph and see if it changed at all and
> > only blit the ones that actually changed.  Well, I'm sure that would
> > make things lightning fast ;)
> >
> > I'm not sure if that's interesting to anyone at all.  But I will say,
> > Racket really is a joy to work with!  Thanks for making a toolbox so
> > much fun I accidentally lose a number of hours to something like this :)
> >
> > - Chris
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] What is the right way to generate HTML from the web server?

2018-01-04 Thread Jay McCarthy
FWIW, txexpr is essentially just `xexpr->string` but it sees when you
put in a `script` or `style` and it puts the `make-cdata` for you. (It
also does a bit more checking to make sure the xexpr is well-formed.)

On Thu, Jan 4, 2018 at 2:30 PM, Philip McGrath  wrote:
> (For posterity, because I realized I didn't explicitly say this:)
>
> The cdata structure effectively just tells functions like `write-xexpr` to
> write the string it contains without any escaping. In particular, it doesn't
> add the "" implied by using CDATA in
> actual XML, which is what we take advantage of when we use it to write
> not-really-XML. All of this is documented at
> http://docs.racket-lang.org/xml/index.html#(def._((lib._xml%2Fmain..rkt)._cdata)),
> but I know that wasn't the first place I thought to look when I wanted to
> write inline JavaScript.
>
> -Philip
>
> On Thu, Jan 4, 2018 at 2:21 PM, Matt Jadud  wrote:
>>
>> Many thanks for all of the responses. I have no fear of the parentheses,
>> and will likely end up with a number of wrappers like you describe, Phillip.
>> I hadn't (yet) twigged to possibly wrapping things up in a CDATA section,
>> but that makes sense.
>>
>> Now if we just had a Racket library that shoveled snow...
>>
>> On Thu, Jan 4, 2018 at 2:07 PM, Philip McGrath 
>> wrote:
>>>
>>> FWIW, I use `response/xexpr` in production with a `#:preamble` of
>>> `#"\n"`, and I haven't run into problems.
>>>
>>> The biggest non-obvious thing, since I see you're generating a script
>>> element, is that `response/xexpr` (and the underlying
>>> `xexpr->string`/`write-xexpr`) properly escape < and & in body strings. This
>>> is a huge win in preventing injection/cross-site scripting, but HTML expects
>>> inline script and style elements not to be escaped. You can achieve this by
>>> replacing
>>> `(script ([type "text/javascript"]) ,(generate-some-javascript))
>>> with
>>> `(script ([type "text/javascript"]) ,(make-cdata #f #f
>>> (generate-some-javascript)))
>>>
>>> (If you want to go beyond that and respect the cdata-ness of the cdata,
>>> there are tricks for both CSS and JavaScript to put the 

Re: [racket-users] What is the right way to generate HTML from the web server?

2018-01-04 Thread Jay McCarthy
I don't think the perfect library exists, because HTML has changed
considerably since most Racket libraries were written.

I think xexpr do 90% of the job, but fails on the issues mentioned in
that issue. I think the best option right now is either

txexpr --- http://docs.racket-lang.org/txexpr/index.html

or

html-writing --- http://docs.racket-lang.org/html-writing/index.html

But I think the perfect system is yet to be done. (I think it would
have elements of these two, plus css-expr, for instance.)

Jay


On Thu, Jan 4, 2018 at 11:48 AM, Matt Jadud <m...@jadud.com> wrote:
> Hi all,
>
> I read through this issue:
>
> https://github.com/racket/racket/issues/577
>
> and am in the "what is going on?" category of user when it comes to HTML
> generation in Racket. What should I be using to generate responses from a
> servlet? response/xexpr? Does that generate HTML I can use practically? Or,
> doesn't it?
>
> I've spent a lot of time in the last few days chasing the generation of TOTP
> URIs for use with apps like Authy/FreeOTP/etc. I finally realized that I'm
> passing strings like
>
> otpauth://totp/handin:astud...@foo.edu?secret=NODOFamp;issuer=handinamp;algorithm=SHA1amp;digits=6amp;period=30
>
> to the Javascript layer for QR encoding. This looks bad to me.
>
> What is the best way to generate HTML from the webserver? I don't care about
> XML vs. HTML; I just want the fastest path to writing a small web
> application that solves a problem that I have, and part of that means easily
> generating HTML that does what I expect when I generate it. That is,
>
>(body
> (div ((id "QRCODE")))
> (script ((type "text/javascript"))
> ,(format "new
> QRCode(document.getElementById('QRCODE'), '~a');"
>  (generate-otp-uri email secret)
>
> seems not to do what I expect, which in this case is causing some rather
> subtle challenges to chase down. ("Why does my test for TOTP encoding pass
> *here*, and generate numbers that match *this* app when I enter data by
> hand, but fail in the same app when I read the QR code that I generated...")
>
> Pointers to relevant documentation appreciated.
>
> Cheers,
> Matt
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Byte Order Mark: alter display of symbols containing nonprinting characters?

2017-12-27 Thread Jay McCarthy
Okay. I think I understand.

The behavior of "two things print the same but are actually different"
that Racket has seems to be the same as my editor and Web browser
which don't render the BOM as anything unless I fiddle something in
Emacs. Additionally, it seems painful to make it do it a different
way.

On Wed, Dec 27, 2017 at 10:26 PM, John Clements
<cleme...@brinckerhoff.org> wrote:
>
>
>> On Dec 27, 2017, at 19:06, Jay McCarthy <jay.mccar...@gmail.com> wrote:
>>
>> This seems to be consistent with my Web browser and editor. Are the
>> symbols eq? or equal?
>
> Neither. Am I misunderstanding you? Here’s code:
>
> #lang racket
>
> (define bad-symbol (string->symbol "\uFEFFhello"))
>
> (define regular-symbol 'hello)
>
> bad-symbol
> regular-symbol
> (equal? bad-symbol regular-symbol)
> (eq? bad-symbol regular-symbol)
>
> this evaluates in DrR to:
>
> Welcome to DrRacket, version 6.11.0.5--2017-12-20(-/f) [3m].
> Language: racket, with debugging; memory limit: 4096 MB.
> 'hello
> 'hello
> #f
> #f
>>
>
> If you copy and paste these from the interactions into the definitions 
> window, you can even get this:
>
> #lang racket
>
> (equal? 'hello 'hello)
> (eq? 'hello ‘hello)
>
> evaluates to:
>
> Welcome to DrRacket, version 6.11.0.5--2017-12-20(-/f) [3m].
> Language: racket, with debugging; memory limit: 4096 MB.
> #f
> #f
>>
>
> Did you misunderstand me, or did I misunderstand you?
>
> John
>
>
>
>
>
>>
>
>> On Wed, Dec 27, 2017 at 3:54 PM, 'John Clements' via Racket Users
>> <racket-users@googlegroups.com> wrote:
>>> I was working with files containing a Byte Order Mark today, and in the 
>>> process of writing a test case, I discovered that
>>>
>>> (string->symbol “\uFEFF”)
>>>
>>> produces a symbol whose printed representation is
>>>
>>> ‘hello
>>>
>>> … which seems unfortunate; I guess I would have expected something like
>>>
>>> ‘|\uFEFFhello|
>>>
>>> (… although I see now that this kind of escaping is not currently enabled 
>>> inside vertical bars).
>>>
>>> This leads to situations where two symbols with the same printed 
>>> representation may not be equal?, which seems unfortunate.
>>>
>>> Am I overlooking a good reason why this is the desired behavior?
>>>
>>> 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.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> -=[ Jay McCarthy   http://jeapostrophe.github.io]=-
>> -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
>> -=[ Moses 1:33: And worlds without number have I created; ]=-
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Byte Order Mark: alter display of symbols containing nonprinting characters?

2017-12-27 Thread Jay McCarthy
This seems to be consistent with my Web browser and editor. Are the
symbols eq? or equal?

On Wed, Dec 27, 2017 at 3:54 PM, 'John Clements' via Racket Users
<racket-users@googlegroups.com> wrote:
> I was working with files containing a Byte Order Mark today, and in the 
> process of writing a test case, I discovered that
>
> (string->symbol “\uFEFF”)
>
> produces a symbol whose printed representation is
>
> ‘hello
>
> … which seems unfortunate; I guess I would have expected something like
>
> ‘|\uFEFFhello|
>
> (… although I see now that this kind of escaping is not currently enabled 
> inside vertical bars).
>
> This leads to situations where two symbols with the same printed 
> representation may not be equal?, which seems unfortunate.
>
> Am I overlooking a good reason why this is the desired behavior?
>
> 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.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Using web cells in #lang web-server/insta

2017-12-26 Thread Jay McCarthy
No, `web-server/lang/web-cells` is for `#lang web-server`

`#lang web-server/insta` is just like `racket` but it includes a call
to `serve/servlet`

On Tue, Dec 26, 2017 at 5:27 AM, Christian <7enderh...@gmail.com> wrote:
> Am I correct to assume that when using web cells with #lang
> web-server/insta, I should (require web-server/lang/web-cells) rather than
> (require web-server/servlet/web-cells)?
> (The former implementation seems to have a problem:
> https://github.com/racket/racket/issues/1918)
>
> Thanks for your consideration,
> Christian
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] Formlets: No binding for 'select-input' without selection and values bound to binding:form

2017-12-21 Thread Jay McCarthy
t;  `(html
>(head (title "Stop Info"))
>(body (h1 "List of Stops")
>  (h2 ,(if stop
>   (stop-name stop)
>   "no stop selected"))
>  (form ([action ,(embed/url render-info-page)])
>,@(formlet-display form-formlet)
>(p (input ([type "submit"]
>  
>   (send/suspend/dispatch response-generator))
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] minor proposed update to docs typography

2017-11-20 Thread Jay McCarthy
It all looks beautimous to me!

On Sun, Nov 19, 2017 at 11:13 PM, Matthew Butterick <m...@mbtype.com> wrote:
> http://mbutterick.github.io/racket-doc-redo/doc/
>
> This link demos some small typographic updates to the docs:
>
> + new title font (that matches the one used on other Racket websites)
> + new monospaced font (that matches the subhead font)
> + some technical tweaks to the body font to make Windows rendering better
> + 20% smaller font download
>
> If something looks wrong, I welcome bug reports. But here's the kind of bug
> report most likely to move me to action: email me* a screen shot of the
> problem page, and also a comparable page on docs.racket-lang.org so I
> understand how they both look on YOUR machine.
>
> In the past, people have liked to send me novelistic reports like "well MB,
> if you look at the docs on a Google Antitrustbook Mini running Debian
> Ultraluxe 2014 with the Squealing MocoLoco browser ..." At which point I
> slide out of my chair, unconscious. All I need are the screenshots. Really.
> Thank you.
>
> PS Or make a GH issue
>
> https://github.com/mbutterick/racket-doc-redo/issues
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] `raco pkg install` from private GitHub repo?

2017-10-27 Thread Jay McCarthy
I'm going to go with exn:fail? in this case and push that.

On Thu, Oct 26, 2017 at 12:11 PM, Matthew Flatt <mfl...@cs.utah.edu> wrote:

> Yes, that makes sense. The "checkout initial protocol failed" error is
> from the package manager in "private/stage.rkt". If the package manager
> didn't provide `#:initial-error` there, then `git-checkout` would raise
> an `exn:fail:git` exception.
>
> At Thu, 26 Oct 2017 09:04:35 -0700, Matthew Butterick wrote:
> > FWIW for this command:
> >
> > raco pkg install https://github.com/mbutterick/app.git
> >
> > The exception is `exn:fail:user` ("raco pkg install: Git checkout initial
> > protocol failed;
> >  the given URL might not refer to a Git repository")
> >
> >
> > And for this command:
> >
> > raco pkg install http://github.com/mbutterick/app.git
> >
> > The exception is `exn:fail:network` ("ssl-connect: connect failed
> > (error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol")
> >
> >
> > Changing the `exn:fail:git?` to just `exn:fail?` repairs the https case:
> >
> > raco pkg install https://github.com/mbutterick/app.git
> >
> > But not the http one:
> >
> > raco pkg install http://github.com/mbutterick/app.git
> >
> > (Though AFAIK that error is valid: there's no vanilla http access
> available to
> > GH)
> >
> >
> > So maybe the problem is that `raco pkg install` is raising the wrong
> kind of
> > error when "Git checkout initial protocol fails" (`exn:fail:user`
> instead of
> > `exn:fail:git`)?
> >
> >
> > > On Oct 26, 2017, at 8:12 AM, Jay McCarthy <jay.mccar...@gmail.com>
> wrote:
> > >
> > > Okay, what's going on here is that it is supposed to first try without
> > > your password and then try with it. But it is failing with something
> > > other than a exn:fail:git? so it isn't catching it and trying again.
> > > We either need to change that to exn:fail? or audit net/git-checkout
> > > and make sure that it is catching every possible network error and
> > > transforming it into a exn:fail:git error. The first is clearly going
> > > to work but I can see that the second is what Matthew intended to be
> > > done when he wrote this. @mflatt, can you weigh in?
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


Re: [racket-users] `raco pkg install` from private GitHub repo?

2017-10-26 Thread Jay McCarthy
Okay, what's going on here is that it is supposed to first try without
your password and then try with it. But it is failing with something
other than a exn:fail:git? so it isn't catching it and trying again.
We either need to change that to exn:fail? or audit net/git-checkout
and make sure that it is catching every possible network error and
transforming it into a exn:fail:git error. The first is clearly going
to work but I can see that the second is what Matthew intended to be
done when he wrote this. @mflatt, can you weigh in?

On Thu, Oct 26, 2017 at 12:56 AM, Matthew Butterick <m...@mbtype.com> wrote:
> I think I found the problem. On this line:
>
> https://github.com/racket/racket/blob/master/racket/collects/pkg/private/checkout-credentials.rkt#L10
>
> The variable `credentials-list` starts out as
>
> [credentials-list (cons #f (get-git-checkout-credentials))]
>
> My correct checkout credentials do appear in
> `(get-git-checkout-credentials)`. But on the next line we have:
>
> (define credentials (first credentials-list))
>
> So the first value assigned to `credentials` is #f. This percolates through,
> and when I run this command:
>
> raco pkg install https://github.com/mbutterick/app.git
>
> The args received by `git-checkout` are:
>
> host = "github.com"
> repo = "mbutterick/app.git"
> dest-dir = #f
> transport = 'https
> ref = "master"
> given-depth = 1
> initial-error = #
> given-tmp-dir = #f
> clean-tmp-dir? = #t
> verify? = #t
> given-port = #f
> strict-links? = #f
> username = #f
> password = #f
>
> Notice the username and password are #f.
>
> But when I go back to "checkout-credentials.rkt" and change this expression:
>
> [credentials-list (cons #f (get-git-checkout-credentials))]
>
> To this:
>
> [credentials-list (get-git-checkout-credentials)]
>
> Then my username and password get passed to `raco pkg install
> https://github.com/mbutterick/app.git`, and everything works as expected:
>
> host = "github.com"
> repo = "mbutterick/app.git"
> dest-dir = #f
> transport = 'https
> ref = "master"
> given-depth = 1
> initial-error = #
> given-tmp-dir = #f
> clean-tmp-dir? = #t
> verify? = #t
> given-port = #f
> strict-links? = #f
> username = "mbutterick"
> password = "password"
>
> Notice that the username and password now get passed through.
>
>
>
>
>
> On Oct 25, 2017, at 6:50 PM, Jay McCarthy <jay.mccar...@gmail.com> wrote:
>
> Mmm, that SHOULD be the same code path as what `raco pkg` is using.
> Could you plop an eprintf on this line and see what arguments `raco
> pkg` is giving `git-checkout` and we can see what code is at fault?
>
> https://github.com/racket/racket/blob/master/racket/collects/net/git-checkout.rkt#L54
>
> On Wed, Oct 25, 2017 at 2:55 PM, Matthew Butterick <m...@mbtype.com> wrote:
>
> The command seems to work when I remove the .git suffix:
>
> racket -l net/git-checkout -- --https -u mbutterick -p password github.com
> /mbutterick/app test
>
> Output:
>
> Contacting github.com
> Getting refs
> Getting 24 objects
> Applying deltas
> Extracting tree to test
> Cleaning up
> "315d1dee1f9e3f90587171d13cc4477756156300"
>
>
>
> On Oct 25, 2017, at 10:08 AM, Jay McCarthy <jay.mccar...@gmail.com> wrote:
>
> Will you try this first so we can debug the protocol level stuff?
>
> racket -l net/git-checkout -- --https -u mbutterick -p password
> github.com /mbutterick/repo.git test
>
> You may need to fiddle with the second to last argument.
>
> On Tue, Oct 24, 2017 at 6:00 PM, Matthew Butterick <m...@mbtype.com> wrote:
>
> PS Same behavior on Ubuntu 14.04 or Mac OS 10.12.6, using Racket 6.10.1 in
> both cases.
>
>
> On Oct 24, 2017, at 2:57 PM, Matthew Butterick <m...@mbtype.com> wrote:
>
> Things seem to be on the right track, and then fail:
>
> Querying Git references for app at http://github.com/mbutterick/app.git
> ssl-connect: connect failed (error:140770FC:SSL
> routines:SSL23_GET_SERVER_HELLO:unknown protocol)
> [long traceback]
>
>
>
>
>
> --
> -=[ Jay McCarthy   http://jeapostrophe.github.io]=-
> -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
> -=[ Moses 1:33: And worlds without number have I created; ]=-
>
>
>
>
>
> --
> -=[ Jay McCarthy   http://jeapostrophe.github.io]=-
> -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
> -=[ Moses 1:33: And worlds without number have I created; ]=-
>
>



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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


  1   2   3   4   >