[racket-users] Re: RacketCon 2021

2021-11-04 Thread Jay McCarthy
Get hyped! It's happening this weekend!

First the social tomorrow afternoon, then the talks on the weekend!

NOTE: The schedule was revised slightly, with the Sunday talks being pushed
back two hours in the day, but ending at the same time overall.

Jay

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


On Fri, Oct 22, 2021 at 9:10 AM Jay McCarthy  wrote:

> Here's a schedule for event, with abstracts and speakers:
>
> https://con.racket-lang.org/
>
> Get hyped!
>
> Jay
>
> --
> Jay McCarthy
> Associate Professor @ CS @ UMass Lowell
> http://jeapostrophe.github.io
> Vincit qui se vincit.
>
> On Sat, Sep 4, 2021 at 8:54 AM Jay McCarthy 
> wrote:
> >
> > In November 2021, on the weekend of the 5th through 7th, we'll be
> holding a virtual RacketCon, like we did in October 2020.
> >
> > We'll follow a similar pattern to last year: an evening social on
> Friday, then talks on Saturday and Sunday.
> >
> > Please put this on your calendars, and please let me know if you have a
> talk in mind that you'd like to give.
> >
> > Best regards,
> >
> > 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/CAJYbDakhjp0jdozH-nCO2yfChUA4mrywweLpSAXzheHKRQdB9Q%40mail.gmail.com.


[racket-users] Re: RacketCon 2021

2021-10-22 Thread Jay McCarthy
Here's a schedule for event, with abstracts and speakers:

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

Get hyped!

Jay

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

On Sat, Sep 4, 2021 at 8:54 AM Jay McCarthy  wrote:
>
> In November 2021, on the weekend of the 5th through 7th, we'll be holding a 
> virtual RacketCon, like we did in October 2020.
>
> We'll follow a similar pattern to last year: an evening social on Friday, 
> then talks on Saturday and Sunday.
>
> Please put this on your calendars, and please let me know if you have a talk 
> in mind that you'd like to give.
>
> Best regards,
>
> 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/CAJYbDakAqHAoAztJ-3kL1A2mLhW8UY-K5nyceH_%2Btru24oFAkw%40mail.gmail.com.


Re: [racket-users] What is the correct name for non-list parenthesized forms?

2021-09-24 Thread Jay McCarthy
On Fri, Sep 24, 2021 at 2:45 PM David Storrs  wrote:

> Offtopic question for someone else:  Jay, are you related to
> Lisp-inventory John McCarthy?
>

Nope, although we have the same name and nickname

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%3DEoeBeor0MceS%2BqSNGoKt5UwmZfyk6Y65Vi-OTLj5AEA%40mail.gmail.com.


Re: [racket-users] What is the correct name for non-list parenthesized forms?

2021-09-24 Thread Jay McCarthy
I think the word you're looking for is "syntax". Many people think that
languages like Racket "don't have syntax" or "have uniform syntax", but
this is an example of how that is incorrect. Each macro has its own unique
syntax and this is an example of how `let` has a unique syntax where `(`
does _not_ mean "apply a function" or "apply a macro".

As a poor analogy, many human languages have a wide set of phonemes and you
combine those in certain rules (like you can't have 27 consonant sounds in
a row) and then use them in wider situations that we call grammar. I like
to think that languages like C has lots of phonemes and little grammar,
because there are lots of rules about how to form "C words" but basically
no rules for how to form "C sentences", because there's a lot of uniformity
in how expressions and statements combine. In contrast, languages like
Racket have very few phonemes (this is what I think people mean why they
say "there is no syntax") but many varied rules (in fact, arbitrary,
because macros can customize them) for combining those smaller units.

Jay

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


On Fri, Sep 24, 2021 at 1:25 PM David Storrs  wrote:

> Racket has a number of forms that include what look like lists of lists
> but are not.  For example:  (let ((foo 7) (bar 8)) ...)
>
> What would the '(foo 7)' and '(bar 8)' elements be called?  Groups, maybe?
>
> --
> You received this message because you are subscribed to the Google 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/CAE8gKodX800fK45c_dyVFCNB-AKmYmK26DxC42ZRDVHdzJ2Q7g%40mail.gmail.com
> <https://groups.google.com/d/msgid/racket-users/CAE8gKodX800fK45c_dyVFCNB-AKmYmK26DxC42ZRDVHdzJ2Q7g%40mail.gmail.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/CAJYbDamFTUsORe%3D07H9FROrA0bcYFbFv0PqFdapey0JqsQ-bPQ%40mail.gmail.com.


[racket-users] RacketCon 2021

2021-09-04 Thread Jay McCarthy
In November 2021, on the weekend of the 5th through 7th, we'll be holding a
virtual RacketCon, like we did in October 2020.

We'll follow a similar pattern to last year: an evening social on Friday,
then talks on Saturday and Sunday.

Please put this on your calendars, and please let me know if you have a
talk in mind that you'd like to give.

Best regards,

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/CAJYbDakBH_qxcbnUwHEWPBM6yh4KVtQWQR%2B8TA%3D4jPYu8tEVkA%40mail.gmail.com.


Re: [racket-users] Package install conflicts on the Racket package catalog

2021-05-01 Thread Jay McCarthy
Howdy Sergiu,

The conflicts file you link to has all the conflicts for everything
that `pkg-build` builds. The line relevant for you is:

```
doc "manual":
  bystroTeX cbor print-debug ratchet riff simply-scheme typed-compose
```

The solution is to rename your manual from `manual.scrbl` to
`typed-compose.scrbl`. Scribble outputs are in a kind of "global"
namespace.

Jay

--
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, May 1, 2021 at 5:56 AM unlimitedscolobb
 wrote:
>
> Hello,
>
> I checked my package https://pkgd.racket-lang.org/pkgn/package/typed-compose 
> recently and noticed that it listed some "Conflicts" in the field "Most 
> recent build results".  On the other hand, the separate field "Conflicts" 
> slightly above says "None".
>
> When I open the log shown in "Most recent build results" (attached) it starts 
> with the line "Install conflicts:", which as far as I get are not the same 
> thing as "Package Conflicts" explained here in the manual: 
> https://docs.racket-lang.org/pkg/Package_Concepts.html#(part._concept~3aconflicts)
>  .
>
> What are install conflicts?  Should I fix them?  What is the command that 
> generates that log?
>
> (typed-compose also used to have an undeclared dependency, which I have just 
> fixed by updating it's info.rkt.)
>
> -
> Sergiu
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/03bfa876-6418-41a2-a37a-5c39ad13121cn%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/CAJYbDamD5-qGfWTVXykUko2%2B1xniTucg1dTdim%2BiEsYKbkMCuA%40mail.gmail.com.


Re: [racket-users] Re: mixfix and racket 2

2021-03-24 Thread Jay McCarthy
I agree with Roger that the zero-precedence `mixfix` system is a
really elegant middle-ground between Honu and a whole big language.
Something I really like about Pyret is that it doesn't have precedence
and requires parens for legibility.

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

On Wed, Mar 24, 2021 at 1:03 PM Roger Keays  wrote:
>
> Looks promising. The extra enforestation phase does add another layer of 
> complexity though. Also, operators don't use pattern matching, so I presume 
> to support Sorawee's example below, you'd have to parse the syntax after the 
> ? yourself.
>
> I think there is some value to considering zero-precendence 'mixfix' macros. 
> AFAICT, they wouldn't require the enforestation phase, which would make the 
> language model simpler. It does complicate the idea of an 'operator' though. 
> Matching them efficiently could also be a problem. Still, I'm happy to trade 
> operator precedence for simplicity.
>
> On Tue, Mar 23, 2021 at 09:16:55PM -0700, jackh...@gmail.com wrote:
> > Honu's enforestation is approximately this. See https://www.cs.utah.edu/plt/
> > publications/gpce12-rf.pdf. There's been some discussion about whether to 
> > base
> > rhombus on a similar approach.
> > On Tuesday, March 23, 2021 at 8:59:50 AM UTC-7 Roger Keays wrote:
> >
> > From racket-news [1]:
> >
> > mixfix (pkg/src) library allows users to define and use mixfix 
> > operators in
> > Racket, by Sorawee Porncharoenwase.
> >
> > From the mixfix docs [2]:
> >
> > > (define-mixfix-rule (c {~datum ?} t {~datum :} e)
> > (if c t e))
> > > (#true ? 1 : 2)
> > 1
> >
> > This is what I expected to be able to do when I first started 
> > experimenting
> > with various LISPs and Schemes. Supporting only prefix macros seemed 
> > like a
> > bit of limitation to me. If mixfix macros were supported out of the box
> > rather than hacking #%app, it would be easier to combine syntax 
> > libraries.
> > Possible for Racket 2?
> >
> > [1] https://racket-news.com/2021/03/racket-news-issue-48.html
> > [2] https://docs.racket-lang.org/mixfix/
> >
> >
> > --
> > You received this message because you are subscribed to the Google 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/198c4676-08de-4803-9a8b-719d9c298159n%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/sigid.171729a446.20210324170310.GA6862%40papaya.papaya.

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


Re: [racket-users] Best way to say 'block until true'?

2021-03-19 Thread Jay McCarthy
It is not a built-in thing. I am talking about the use-pattern of a
condition variable:
https://en.wikipedia.org/wiki/Monitor_(synchronization)#Condition_variables

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

On Fri, Mar 19, 2021 at 1:02 PM David Storrs  wrote:
>
>
>
> On Fri, Mar 19, 2021 at 12:02 PM Jay McCarthy  wrote:
>>
>> The best thing is to use a semaphore instead of a mutable reference.
>> If you can't do that, then I think that you should combine the mutable
>> reference with a signaling semaphore. If you can't do that, then I
>> can't think of anything but a poll.
>
>
> Is this the kind of thing you meant by 'signalling semaphore'?
>
> #lang racket
>
> (define x #f)
> (define sema (make-semaphore 0))
>
> (define (wait-on-x) (sync (semaphore-peek-evt sema)) always-evt)
> (define (set-x! val)
>   (void (thread ; don't print the thread object when running in the repl
>  (thunk
>   (sleep 3)
>   (set! x val)
>   (semaphore-post sema)
>
> (define (check-x)
>   (match (sync/timeout 10 (wait-on-x))
> [#f (displayln "timeout")]
> [_ (displayln "success")]))
>
> (set-x! 7)
> (check-x)  ; pauses for 3 seconds, then outputs "success"
> (check-x)  ; outputs "success" immediately
> (check-x)  ; ibid
>>
>>
>> --
>> Jay McCarthy
>> Associate Professor @ CS @ UMass Lowell
>> http://jeapostrophe.github.io
>> Vincit qui se vincit.
>>
>> On Fri, Mar 19, 2021 at 11:59 AM David Storrs  wrote:
>> >
>> > Suppose I have a function that tests for some condition, e.g.
>> >
>> > (define current-user (make-parameter #f))
>> > (define (current-user-set?) (not (false? (current-user)))
>> >
>> > What is the best way to say "wait until 'current-user-set?' returns true"? 
>> >  I've been through the Events chapter in the Reference and nothing seems 
>> > like a great fit.  I could do polling via sleep or alarm-evt but that 
>> > seems inefficient.  Is there a better way?
>> >
>> > --
>> > You received this message because you are subscribed to the Google 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/CAE8gKocbPgjcFAF_o2g6mhZBEH8PpeGyJ4CwznKc3DZkMjY%3DGw%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/CAJYbDa%3DNiV7ryAnPp_KJOuyez23FY9ztqr%3Daydij7j4hHLn43g%40mail.gmail.com.


Re: [racket-users] Best way to say 'block until true'?

2021-03-19 Thread Jay McCarthy
The best thing is to use a semaphore instead of a mutable reference.
If you can't do that, then I think that you should combine the mutable
reference with a signaling semaphore. If you can't do that, then I
can't think of anything but a poll.

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

On Fri, Mar 19, 2021 at 11:59 AM David Storrs  wrote:
>
> Suppose I have a function that tests for some condition, e.g.
>
> (define current-user (make-parameter #f))
> (define (current-user-set?) (not (false? (current-user)))
>
> What is the best way to say "wait until 'current-user-set?' returns true"?  
> I've been through the Events chapter in the Reference and nothing seems like 
> a great fit.  I could do polling via sleep or alarm-evt but that seems 
> inefficient.  Is there a better way?
>
> --
> You received this message because you are subscribed to the Google 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/CAE8gKocbPgjcFAF_o2g6mhZBEH8PpeGyJ4CwznKc3DZkMjY%3DGw%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/CAJYbDanE4zqgFRAFSYs4kdLzjKf9xg3xi0JMNU7VmFREstNBgQ%40mail.gmail.com.


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

2021-03-09 Thread Jay McCarthy
I like this a lot! Great job!

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

On Tue, Mar 9, 2021 at 10:20 AM Roger Keays  wrote:
>
> Hi all,
>
> I recently publish a new package called *fluent* which adds some syntax 
> enhancements to Racket. Links and README below. Let me know what you think...
>
> Roger
>
> https://pkgs.racket-lang.org/package/fluent
> https://github.com/rogerkeays/racket-fluent/
>
> # fluent
>
> UNIX style pipes and a lambda shorthand syntax to make your Racket code more 
> readable.
>
> ## ? Unpopular So LISP Is Why
>
> Let's be honest. LISP missed a huge opportunity to change the world by 
> telling developers they have to think backwards. Meanwhile, UNIX became 
> successful largely because it allows you to compose programs sequentially 
> using pipes. Compare the difference (the LISP example is actually racket):
>
> UNIX: cat data.txt | grep "active" | cut -f 4 | uniq | sort
> LISP: (sort (remove-duplicates (map (λ (line) (list-ref (string-split 
> line) 4)) ((filter (λ (line) (string-contains? line "active")) (file->lines 
> "data.txt"))
>
> Using *fluent*, the same racket code can be written according to the UNIX 
> philosophy:
>
> ("data.txt" > file->lines >> filter (line : line > string-contains? 
> "active") >> map (line : line > string-split > list-ref 4) > 
> remove-duplicates > sort)
>
> You can use unicode → instead of > if you prefer. It is more distinctive and 
> a bit easier on the eyes:
>
> ("data.txt" → file->lines →→ filter (line : line → string-contains? 
> "active") →→ map (line : line → string-split → list-ref 4) → 
> remove-duplicates → sort)
>
> ## Function Composition
>
> Using the function composition operator (> or →), *fluent* inserts the left 
> hand side as the first parameter to the procedure on the right hand side. Use 
> >> (or →→) to add the left hand side as the last parameter to the procedure.
>
> (data > procedure params) becomes(procedure data params)
> (data >> procedure params)becomes(procedure params data)
>
> This operation can be chained or nested as demonstrated in the examples.
>
> ## Lambda Shorthand
>
> The : operator allows you to easily write a lambda function with one 
> expression. Parameters go on the left, the expression on the right, no 
> parentheses required. For example:
>
> > ((x : + x 1) 1)
> 2
> > ((x y : + x y) 1 2)
> 3
> > (map (x : string-upcase x) '("a" "b" "c"))
> '("A" "B" "C")
>
> ## Math Procedures
>
> Since this library uses > for function composition, the built in greater-than 
> procedure is renamed to `gt?`. Note, this could break existing code if you 
> are already using the > procedure. Other math procedures are also renamed for 
> consistency, and because the text versions read more naturally when using 
> function composition.
>
> > gt?
> < lt?
> >= gte?
> <= lte?
> + add
> - subtract
> * multiply
> / divide
>
> ## Convenience Procedures
>
> *fluent* works best when the data (input) parameter comes first. Most racket 
> functions do this out of the box, but many functions which take a procedure 
> as a parameter put the data last. That's fine, because you can just use >>. 
> Alternatively you can wrap and rename the procedure, which is what we've done 
> for these functions:
>
> original   data-first version
> -
> for-each   iterate
>
> example:
>
> > ('(1 2 3) → iterate (x : displayln x))
> 1
> 2
> 3
>
> ## Comparison to Clojure's Threading Macro
>
> Clojure's threading macro is a prefix operator, which means it is less 
> readable when nested and requires more parentheses. You could say that the 
> *fluent* infix operator acts as one parenthesis. Compare:
>
> CLOJURE (prefix):
>
> (-> (list (-> (-> id3 (hash-ref 'genre "unknown")) normalise-field)
>   (-> (-> id3 (hash-ref 'track "0")) normalise-field)
>   (-> (-> id3 (hash-ref 'artist "unknown")) normalise-field)
>   (-> (-> id3 (hash-ref 'title "unknown")) normalise-field)) 
> (string-join "."))
>
> FLUENT (infix):
>
> (list (id3 → hash-ref 'genre "unknown" → normalise-field)
>   (id3 → hash-ref 'track "0"

Re: [racket-users] the future of #lang web-server

2021-02-25 Thread Jay McCarthy
That's a cute idea. We do something like that already when sharing the
serialized continuation with the world, but Racket could conceivably do
that when it `read`/`write`s things, although it would be very odd.

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


On Thu, Feb 25, 2021 at 3:28 AM jackh...@gmail.com 
wrote:

> Could you cryptographically sign the serialized form or something like
> that?
>
> On Monday, February 22, 2021 at 8:59:29 AM UTC-8 jay.mc...@gmail.com
> wrote:
>
>> On Sun, Feb 21, 2021 at 2:35 PM je...@lisp.sh  wrote:
>> >
>> > #lang web-server is brilliant. This #lang is, in my view, a really
>> excellent example of Racket's take on language-oriented programming. I find
>> that the performance of continuations is just fine, given my limited use of
>> them, and after a while you get used to the limitations and just program
>> around them.
>>
>> Thanks, a lot of people contributed a ton to it, specifically: Greg
>> Pettyjohn, John Clements, Joe Marshall, Shriram Krishnamurthi,
>> Matthias Felleisen.
>>
>> >
>> > One thing that always bothers me about #lang web-server, though, is
>> that there are a lot of provisos in the documentation. I'm talking about
>> section 3.2, "Usage Considerations", of
>> https://docs.racket-lang.org/web-server/stateless.html, in the part
>> after "However, there are some considerations you must make." Here a couple
>> of questions:
>> >
>> > + " [#lang web-server] 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."
>> >
>> > This seems to me like an interesting research question. Has this
>> question been taken up? I've tried taking a look on Google Scholar for any
>> follow-up. I looked at citations of Jay's "Automatically RESTful web
>> applications" and "The two-state solution: native and serializable
>> continuations accord", but nothing stuck out to me (...which is not to say
>> that there may have missed something).
>>
>>
>> I never did any more research about this. I think you could take the
>> traditional Scheme benchmarks ---
>>
>> https://github.com/racket/racket/tree/master/pkgs/racket-benchmarks/tests/racket/benchmarks/common
>> --- and add `#lang web-server` to the top and see what happens.
>>
>> >
>> > + Some limitations of #lang web-server seem don't seem obviously
>> necessary, at least to someone who's not very familiar with the precise
>> details of the underlying program transformations. You get used to them,
>> but you wonder if there's some accessible world in which they work. For
>> example: "You may not use parameterize, because parameterizations are not
>> serializable." Is that inherently so (that is, there's no way around that,
>> no matter how clever you tweak the program transformations on which #lang
>> web-server rests), or is that just a conequence of the particular approach
>> taken (maybe it's possible, but no one has done it yet). Has there been any
>> fresh thinking about these limitations?
>>
>> In some sense, everything is possible, because we can just change the
>> way the VM works... the existing `#lang web-server` is designed to
>> never require modifications down there. In the case of `parameterize`,
>> the problem is a matter of security. Consider the following program:
>>
>> ```
>> #lang racket
>> (define p (make-parameter #t))
>> (define (launch-the-missiles!)
>> (when (p) .))
>> (define (run-code-downloaded-from-youtube f)
>> (parameterize ([p #f]) (f)))
>> ```
>>
>> We don't want the code from YouTube to be able to launch the missiles.
>> Suppose that parameterizations were serializeable, then the YouTube
>> code could be something like:
>>
>> ```
>> (lambda ()
>> (call-with-parameterization
>> (read (with-input-string (hack-the-planet (with-output-to-string
>> (lambda () (write (current-parameterization)
>> launch-the-missiles!))
>> ```
>>
>> where `hack-the-planet` changes the `#f` to `#t`. That's why you can't
>> inspect parameterizations or enumerate the keys in a continuation mark
>> set.
>>
>> In general, all of the limitations of `#lang web-server` are because
>> of things like this.
>>
>> Jay
>>
>> --
>> Jay McCarthy
>> Associate Professor @ CS @ UMass Lowell
>> http://jeapostrophe.git

Re: [racket-users] the future of #lang web-server

2021-02-22 Thread Jay McCarthy
On Sun, Feb 21, 2021 at 2:35 PM je...@lisp.sh  wrote:
>
> #lang web-server is brilliant. This #lang is, in my view, a really excellent 
> example of Racket's take on language-oriented programming. I find that the 
> performance of continuations is just fine, given my limited use of them, and 
> after a while you get used to the limitations and just program around them.

Thanks, a lot of people contributed a ton to it, specifically: Greg
Pettyjohn, John Clements, Joe Marshall, Shriram Krishnamurthi,
Matthias Felleisen.

>
> One thing that always bothers me about #lang web-server, though, is that 
> there are a lot of provisos in the documentation. I'm talking about section 
> 3.2, "Usage Considerations", of 
> https://docs.racket-lang.org/web-server/stateless.html, in the part after 
> "However, there are some considerations you must make." Here a couple of 
> questions:
>
> + " [#lang web-server] 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."
>
> This seems to me like an interesting research question. Has this question 
> been taken up? I've tried taking a look on Google Scholar for any follow-up. 
> I looked at citations of Jay's "Automatically RESTful web applications" and 
> "The two-state solution: native and serializable continuations accord", but 
> nothing stuck out to me (...which is not to say that there may have missed 
> something).


I never did any more research about this. I think you could take the
traditional Scheme benchmarks ---
https://github.com/racket/racket/tree/master/pkgs/racket-benchmarks/tests/racket/benchmarks/common
--- and add `#lang web-server` to the top and see what happens.

>
> + Some limitations of #lang web-server seem don't seem obviously necessary, 
> at least to someone who's not very familiar with the precise details of the 
> underlying program transformations. You get used to them, but you wonder if 
> there's some accessible world in which they work. For example: "You may not 
> use parameterize, because parameterizations are not serializable." Is that 
> inherently so (that is, there's no way around that, no matter how clever you 
> tweak the program transformations on which #lang web-server rests), or is 
> that just a conequence of the particular approach taken (maybe it's possible, 
> but no one has done it yet). Has there been any fresh thinking about these 
> limitations?

In some sense, everything is possible, because we can just change the
way the VM works... the existing `#lang web-server` is designed to
never require modifications down there. In the case of `parameterize`,
the problem is a matter of security. Consider the following program:

```
#lang racket
(define p (make-parameter #t))
(define (launch-the-missiles!)
 (when (p) .))
(define (run-code-downloaded-from-youtube f)
 (parameterize ([p #f]) (f)))
```

We don't want the code from YouTube to be able to launch the missiles.
Suppose that parameterizations were serializeable, then the YouTube
code could be something like:

```
(lambda ()
 (call-with-parameterization
  (read (with-input-string (hack-the-planet (with-output-to-string
(lambda () (write (current-parameterization)
  launch-the-missiles!))
```

where `hack-the-planet` changes the `#f` to `#t`. That's why you can't
inspect parameterizations or enumerate the keys in a continuation mark
set.

In general, all of the limitations of `#lang web-server` are because
of things like this.

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/CAJYbDam9-SkkRrKQSWzmAUuJTf0%3D5wAXOjJDAY0aaDe95XK-Wg%40mail.gmail.com.


Re: [racket-users] Finding Module Names

2021-02-21 Thread Jay McCarthy
I think you want to look at either

quote-module-name from
https://docs.racket-lang.org/syntax/Source_Locations.html#%28part._.Quoting%29

or maybe

syntax-source-module
https://docs.racket-lang.org/reference/stxops.html?q=syntax-module#%28def._%28%28quote._~23~25kernel%29._syntax-source-module%29%29

Jay

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

On Sun, Feb 21, 2021 at 4:54 AM Aaron Eline
 wrote:
>
>
> I was wondering if there was a way to find the name of the current module?
> Trying to write a macro that takes actions based on the module name?
>
> --
> You received this message because you are subscribed to the Google 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/8d110ed0-3663-45fc-8d93-503fac28c98en%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/CAJYbDanO7%2BMpUAZibZPzW3HFeKXCmy-DQ84EpXz4OZMABGzhcQ%40mail.gmail.com.


Re: [racket-users] Does password reset work on pkgs.racket-lang.org?

2021-02-01 Thread Jay McCarthy
I just checked it and I got an email, but it was put into spam.

If you can't identify a problem on your side, contact me off list and
we can debug together.

Jay

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

On Sat, Jan 30, 2021 at 9:56 PM Danny Yoo  wrote:
>
> Hi everyone,
>
> Unfortunately, it looks like the password on my account 
> (d...@hashcollision.org) on pkgd.racket-lang.org got compromised recently, so 
> I'm trying to figure out how to reset it now.
>
> I don't see an option to do so except in the Login page.  When I try to do 
> so, I ask it to "Email me a code", but it doesn't seem to be working.  I've 
> checked my spam folder just to check, but don't see it in there as well.  Any 
> suggestions?
>
> Thanks in advance!
>
> --
> You received this message because you are subscribed to the Google 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/32659ebf-55da-47a3-a459-6e664926bc67n%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/CAJYbDanqK0%2BeQvFWXdi0w8Sa5Xfz7dtU-mMaySc%2BEiwAk3b_Dg%40mail.gmail.com.


Re: [racket-users] How do I control where expressions may appear in a module language?

2021-01-01 Thread Jay McCarthy
I’d imagine that you would only provide program and the modifiers.
Everything well work out :)

Jay

On Fri, Jan 1, 2021 at 11:44 AM Sage Gerard  wrote:

> Ah, I see. Thank you for that!
>
> As for rephrasing my original question: If program were provided as
> #%module-begin, I expect that syntax-protect would prevent a programmer
> from
> using out the phase-0 bindings.  But in my version of the program Racket
> would keep complaining about unbound identifiers unless I provided
> everything.
>
> The thing is, I don't want the user to be able to write things like
> set-field* in their program just because I'm forced to provide it.
> That's why I'm trying to figure out a way to say "Ok, this module language
> happens to include set-field*, but set-field* must only appear
> in module context, or not at all."
>
> *~slg*
>
>
> ‐‐‐ Original Message ‐‐‐
> On Thursday, December 31, 2020 1:40 PM, Jay McCarthy <
> jay.mccar...@gmail.com> wrote:
>
> I meant like this:
>
> ```
> #lang racket/base
> (require (for-syntax racket/base
>  syntax/parse)
>  syntax/parse/define)
>
> ;; Run-time
> (struct state (a b c d) #:transparent)
> (define mt (state #f #f #f #f))
> (define-simple-macro (set-field st:expr f:id v:expr)
>   (struct-copy state st [f v]))
> (define-simple-macro (set-field* f:id v:expr)
>   (λ (st) (set-field st f v)))
>
> ;; Compile-time
> (begin-for-syntax
>   (define-struct modifier (f)))
>
> (define-simple-macro (define-modifier (m . args) body)
>   (begin
> (define-syntax m-f
>   (syntax-parser [(_ args) #'body]))
>   (define-syntax m (modifier #'m-f
>
> (define-modifier (the-a-says x:string)
>   (set-field* a x))
> (define-modifier (the-b-says 'x:id)
>   (set-field* b 'x))
> (define-modifier (the-c-is x:string)
>   (set-field* c x))
> (define-modifier (the-d-looks-like x:nat)
>   (set-field* d x))
>
> (define-syntax-parser term
>   [(_ ((~var m (static modifier? "state modifier")) . args))
>#:with f (modifier-f (attribute m.value))
>#'(f args)])
>
> (define-syntax-parser program
>   [(_) #'mt]
>   [(_ x . more) #'((term x) (program . more))])
>
> ;; Example
> (program
>  (the-a-says "Aaah")
>  (the-b-says 'Baah)
>  (the-c-is "Caaah")
>  (the-d-looks-like 42))
> ```
>
> --
> Jay McCarthy
> Associate Professor @ CS @ UMass Lowell
> http://jeapostrophe.github.io
> Vincit qui se vincit.
>
>
> On Thu, Dec 31, 2020 at 12:07 PM Sage Gerard  wrote:
>
>> I didn't see an answer to my original question, but I still want to make
>> sure I understood you before I rephrase. Thank you for the insights!
>>
>> By your three step suggestion, is something like this what you meant? I'm
>> not sure I  understood Step 3. It seems like I still have to add new
>> structure types and macros to define new terms, which is about as laborious
>> as what I was doing with #:datum-literals and struct-copy.
>>
>> (module id racket/base
>>   (require racket/format
>>(for-syntax racket/base syntax/parse))
>>
>>   (begin-for-syntax (struct item (name num)))
>>
>>   (define (record-item name num)
>> (~a num ". " name))
>>
>>   (define-syntax (term stx)
>> (syntax-parse stx
>>   #:literals ([stmt item #:phase 1])
>>   [(_ (stmt name:id num:exact-positive-integer))
>>#'(define name (record-item 'name num))]))
>>
>>   (define-syntax-rule (program x ...)
>> (begin (term x) ...)))
>>
>>
>> *~slg*
>>
>>
>> ‐‐‐ Original Message ‐‐‐
>> On Thursday, December 31, 2020 9:45 AM, Jay McCarthy <
>> jay.mccar...@gmail.com> wrote:
>>
>> Are you trying to take a macro argument and ensure that it is an
>> expression? If so, then you can expand into `#%expression`
>>
>> https://docs.racket-lang.org/reference/__expression.html
>>
>> On the other hand, if you are trying to take a macro argument and ensure
>> that it is NOT an expression... then that means that you know what it is
>> allowed to be, so I don't think there's any better way than to just
>> enumerate what it CAN be. I think I would use a syntax class that specifies
>> the allowable patterns and then use that. For example, in my little
>> teachlog language, I have the `term` syntax class for this purpose
>>
>> https://github.com/jeapostrophe/teachlog/blob/master/main.rkt#L119
>>
>> Looking at your code, I think what I would do is:
>> 1) Define a phase-1 structure that represen

Re: [racket-users] How do I control where expressions may appear in a module language?

2020-12-31 Thread Jay McCarthy
I meant like this:

```
#lang racket/base
(require (for-syntax racket/base
 syntax/parse)
 syntax/parse/define)

;; Run-time
(struct state (a b c d) #:transparent)
(define mt (state #f #f #f #f))
(define-simple-macro (set-field st:expr f:id v:expr)
  (struct-copy state st [f v]))
(define-simple-macro (set-field* f:id v:expr)
  (λ (st) (set-field st f v)))

;; Compile-time
(begin-for-syntax
  (define-struct modifier (f)))

(define-simple-macro (define-modifier (m . args) body)
  (begin
(define-syntax m-f
  (syntax-parser [(_ args) #'body]))
  (define-syntax m (modifier #'m-f

(define-modifier (the-a-says x:string)
  (set-field* a x))
(define-modifier (the-b-says 'x:id)
  (set-field* b 'x))
(define-modifier (the-c-is x:string)
  (set-field* c x))
(define-modifier (the-d-looks-like x:nat)
  (set-field* d x))

(define-syntax-parser term
  [(_ ((~var m (static modifier? "state modifier")) . args))
   #:with f (modifier-f (attribute m.value))
   #'(f args)])

(define-syntax-parser program
  [(_) #'mt]
  [(_ x . more) #'((term x) (program . more))])

;; Example
(program
 (the-a-says "Aaah")
 (the-b-says 'Baah)
 (the-c-is "Caaah")
 (the-d-looks-like 42))
```

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


On Thu, Dec 31, 2020 at 12:07 PM Sage Gerard  wrote:

> I didn't see an answer to my original question, but I still want to make
> sure I understood you before I rephrase. Thank you for the insights!
>
> By your three step suggestion, is something like this what you meant? I'm
> not sure I  understood Step 3. It seems like I still have to add new
> structure types and macros to define new terms, which is about as laborious
> as what I was doing with #:datum-literals and struct-copy.
>
> (module id racket/base
>   (require racket/format
>(for-syntax racket/base syntax/parse))
>
>   (begin-for-syntax (struct item (name num)))
>
>   (define (record-item name num)
> (~a num ". " name))
>
>   (define-syntax (term stx)
> (syntax-parse stx
>   #:literals ([stmt item #:phase 1])
>   [(_ (stmt name:id num:exact-positive-integer))
>#'(define name (record-item 'name num))]))
>
>   (define-syntax-rule (program x ...)
> (begin (term x) ...)))
>
>
> *~slg*
>
>
> ‐‐‐ Original Message ‐‐‐
> On Thursday, December 31, 2020 9:45 AM, Jay McCarthy <
> jay.mccar...@gmail.com> wrote:
>
> Are you trying to take a macro argument and ensure that it is an
> expression? If so, then you can expand into `#%expression`
>
> https://docs.racket-lang.org/reference/__expression.html
>
> On the other hand, if you are trying to take a macro argument and ensure
> that it is NOT an expression... then that means that you know what it is
> allowed to be, so I don't think there's any better way than to just
> enumerate what it CAN be. I think I would use a syntax class that specifies
> the allowable patterns and then use that. For example, in my little
> teachlog language, I have the `term` syntax class for this purpose
>
> https://github.com/jeapostrophe/teachlog/blob/master/main.rkt#L119
>
> Looking at your code, I think what I would do is:
> 1) Define a phase-1 structure that represents one of these fields and an
> associated phase-0 function that records its values
> 2) Define `define-syntax` bindings for each particular field as an
> instance of these fields
> 3) Write `update` as a short `syntax-parse` that expects a list where the
> head is a static instance of the phase-1 structure and expands into an
> application of the associate phase-0 function on the arguments
>
> This would allow you to better abstract things so you don't have tie the
> `update` function to the particular fields.
>
> Jay
>
> --
> Jay McCarthy
> Associate Professor @ CS @ UMass Lowell
> http://jeapostrophe.github.io
> Vincit qui se vincit.
>
>
> On Wed, Dec 30, 2020 at 10:20 PM Sage Gerard  wrote:
>
>> I'm trying to learn how to restrict where expressions appear. Those
>> expressions might be procedure applications, *or* macros before
>> expansion.
>>
>> [1] shows a library I use to help me implement a collection pass for a
>> module language. To save you some reading, it uses syntax-parse with a
>> lengthy #:datum-literals. That's the only way I know how to restrict what
>> expressions appear in module context.
>>
>> One element of the #:datum-literals happens to share an identifier with a
>> bound procedure, so I expand the calls as-is in a module-level expression
>> [2][3]. I want that procedure to be applied ONLY in the module context, but
>> nothing in the language enforces that.
&

Re: [racket-users] How do I control where expressions may appear in a module language?

2020-12-31 Thread Jay McCarthy
Are you trying to take a macro argument and ensure that it is an
expression? If so, then you can expand into `#%expression`

https://docs.racket-lang.org/reference/__expression.html

On the other hand, if you are trying to take a macro argument and ensure
that it is NOT an expression... then that means that you know what it is
allowed to be, so I don't think there's any better way than to just
enumerate what it CAN be. I think I would use a syntax class that specifies
the allowable patterns and then use that. For example, in my little
teachlog language, I have the `term` syntax class for this purpose

https://github.com/jeapostrophe/teachlog/blob/master/main.rkt#L119

Looking at your code, I think what I would do is:
1) Define a phase-1 structure that represents one of these fields and an
associated phase-0 function that records its values
2) Define `define-syntax` bindings for each particular field as an instance
of these fields
3) Write `update` as a short `syntax-parse` that expects a list where the
head is a static instance of the phase-1 structure and expands into an
application of the associate phase-0 function on the arguments

This would allow you to better abstract things so you don't have tie the
`update` function to the particular fields.

Jay

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


On Wed, Dec 30, 2020 at 10:20 PM Sage Gerard  wrote:

> I'm trying to learn how to restrict where expressions appear. Those
> expressions might be procedure applications, *or* macros before expansion.
>
> [1] shows a library I use to help me implement a collection pass for a
> module language. To save you some reading, it uses syntax-parse with a
> lengthy #:datum-literals. That's the only way I know how to restrict what
> expressions appear in module context.
>
> One element of the #:datum-literals happens to share an identifier with a
> bound procedure, so I expand the calls as-is in a module-level expression
> [2][3]. I want that procedure to be applied ONLY in the module context, but
> nothing in the language enforces that.
>
> I don't know what I don't know. Could I please get a link to a part of the
> documentation that teaches me what I need to understand? I'm tied between
> querying syntax properties for a fully expanded module, and writing a
> second set of macros that somehow know where they should be. Not sure which
> is best.
>
> [1]: https://github.com/zyrolasting/xiden/blob/master/pkgdef/expand.rkt
> [2]:
> https://github.com/zyrolasting/xiden/blob/master/pkgdef/expand.rkt#L111
> [3]:
> https://github.com/zyrolasting/xiden/blob/master/pkgdef/expand.rkt#L156
>
> *~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/bVbaZ_0mwFcWTIaeuwqMUr7TVY6Rhr5dusG9LkbT0gqW7gWIYAb8IOEUYnKQPIVR2ZrDGm9QMGnW-2YvYqw81oUJVCSCuwhuX_Wx2OGVG-w%3D%40sagegerard.com
> <https://groups.google.com/d/msgid/racket-users/bVbaZ_0mwFcWTIaeuwqMUr7TVY6Rhr5dusG9LkbT0gqW7gWIYAb8IOEUYnKQPIVR2ZrDGm9QMGnW-2YvYqw81oUJVCSCuwhuX_Wx2OGVG-w%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%3DLQhCO8a4F2nnR_DZOMHOGJzLCqOGw6231fT40gF5VxA%40mail.gmail.com.


Re: [racket-users] Re: changing my email address on the package server?

2020-12-10 Thread Jay McCarthy
The expected thing for you to do is to

1. Create a new account
2. Add that new account as an author to the packages
3. Remove your old account as an author to the packages

If you want, though, I can do a search & replace in the database for you

Jay

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


On Thu, Dec 10, 2020 at 1:06 AM je...@lisp.sh  wrote:

> It occurs to me that another approach here -- possibly a necessary one
> given the current setup of the package server -- would be to manually
> intervene. Presumably, it's possible for a package server admin to just
> manually associate a package with a certain account?
>
> On Thursday, December 10, 2020 at 6:44:41 AM UTC+1 je...@lisp.sh wrote:
>
>> Is it possible to change my email address on the package server? It
>> doesn't appear so, but perhaps I'm missing something. If not, what would be
>> the recommended way of accomplishing an email change? I can create a new
>> account, of course. But how to claim ownership of an existing package? Can
>> one "abandon" a package with account X and "claim" the package with account
>> Y?
>>
>> Jesse
>>
> --
> You received this message because you are subscribed to the Google 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/d9c9ce65-2070-460c-b679-fa2e187da704n%40googlegroups.com
> <https://groups.google.com/d/msgid/racket-users/d9c9ce65-2070-460c-b679-fa2e187da704n%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%3DdDWCq9qTMGNJ49HtCFzchPeeFykqqSMEDeau4xEq-vg%40mail.gmail.com.


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.


  1   2   3   4   >