[racket-users] does handin-server really need racket/gui/base?

2019-08-16 Thread 'Wayne Harris' via Racket Users
I tried the handin-server on a Windows computer and it worked just
fine.  Now I'm trying it on a headless UNIX system and, upon first run,
I got:

$ racket -l handin-server
Unable to init server: Could not connect: Connection refused
Gtk initialization failed for display ":0"
  context...:
   "/usr/share/racket/pkgs/gui-lib/mred/private/wx/gtk/queue.rkt": [running 
body]
   temp37_0
   for-loop
   run-module-instance!125
   for-loop
   [repeats 1 more time]
   run-module-instance!125
   for-loop
   [repeats 1 more time]
   run-module-instance!125
   do-dynamic-require5
   "/usr/share/racket/pkgs/gui-lib/mred/private/wx/platform.rkt": [running body]
   temp37_0
   for-loop
   run-module-instance!125
   for-loop
   ...

Then taking a peek at

  ~/.racket/7.2/pkgs/handin/handin-server/main.rkt

I saw

  (require ...
 ;; workaround for a confusing problem: without this, the gui
 ;; gets initialized in a handler (since checks use it, and
 ;; they're being required dynamically), and further handlers
 ;; will fail with "queue-callback: eventspace is shutdown",
 ;; requiring it here makes it avoids killing the eventspace
 racket/gui/base)

Just to see what happens, I commented out the racket/gui/base
requirement and the server ran, but the comment says there'll be a
confusing problem.

$ racket -l handin-server
[-|2019-08-17T01:52:22] *** embedded web server started
[-|2019-08-17T01:52:22] Cleaning up all submission directories
[-|2019-08-17T01:52:22] *** handin server started on port 7979

Why does the server need anything GUI-related?  How do you run this
server in production?

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


[racket-users] Re: Improved synchronous concurrency example for rosettacode.org ?

2019-08-16 Thread Brian Adkins
On Friday, August 16, 2019 at 6:46:14 PM UTC-4, Brian Adkins wrote:
>
> I went ahead and added my version to the Racket section w/ some subtle 
> changes from my original post. I'm happy to edit it if necessary.
>
> https://rosettacode.org/wiki/Synchronous_concurrency#Racket
>
> I added a note above my entry re: using thread mailboxes, and I added a 
> note above the existing entry re: using channels.
>
> Brian Adkins
>
>>
>>
Thanks to Matthew Butterick, the printer function is much nicer now :)

https://rosettacode.org/wiki/Synchronous_concurrency#Racket 

This latest version compares very favorably with a lot of other languages 
now. Racket continues to pleasantly surprise me - just keep those beautiful 
parens coming :)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/808f7243-7bbc-4f18-9e8b-e88b90e1dda2%40googlegroups.com.


[racket-users] Re: Improved synchronous concurrency example for rosettacode.org ?

2019-08-16 Thread Brian Adkins
I went ahead and added my version to the Racket section w/ some subtle 
changes from my original post. I'm happy to edit it if necessary.

https://rosettacode.org/wiki/Synchronous_concurrency#Racket

I added a note above my entry re: using thread mailboxes, and I added a 
note above the existing entry re: using channels.

Brian Adkins

>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/1733f179-bd48-46ae-87d1-8263cfd8c177%40googlegroups.com.


[racket-users] Improved synchronous concurrency example for rosettacode.org ?

2019-08-16 Thread Brian Adkins
The current Racket example for Synchronous Concurrency seems a little 
verbose and overly complicated:

https://rosettacode.org/wiki/Synchronous_concurrency#Racket

What do you think of the following example instead?

Brian Adkins

--- snip ---
(define (reader)
  (for ([line (in-lines (open-input-file "input.txt"))])
   (thread-send printer-thread line))
  (thread-send printer-thread eof)
  (printf "Number of lines: ~a\n" (thread-receive)))

(define (printer)
  (let loop ([line (thread-receive)][count 0])
(if (eof-object? line)
(thread-send reader-thread count)
(begin
  (printf "~a\n" line)
  (loop (thread-receive)
(add1 count))

(define printer-thread (thread printer))
(define reader-thread  (thread reader))
(thread-wait printer-thread)
--- snip ---

or the following (using a macro probably just muddies the waters, but I 
didn't like the (thread (thunk ... nesting ) :)

--- snip ---
(require syntax/parse/define)

(define-simple-macro (thread-start thread-name:id rhs:expr ...)
  (define thread-name (thread (thunk rhs ...

(thread-start printer-thread
   (let loop ([line (thread-receive)][count 0])
 (if (eof-object? line)
 (thread-send reader-thread count)
 (begin
   (printf "~a\n" line)
   (loop (thread-receive)
 (add1 count))

(thread-start reader-thread
   (for ([line (in-lines (open-input-file "input.txt"))])
(thread-send printer-thread line))
   (thread-send printer-thread eof)
   (printf "Number of lines: ~a\n" (thread-receive)))

(thread-wait printer-thread)
--- snip ---

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


Re: [racket-users] See expanded code?

2019-08-16 Thread Neil Van Dyke
One nice interactive way is with the Macro Stepper feature in DrRacket, 
which is easy to use once you know the button to start it.


Sometimes it helps to copy&paste, into a new file, the minimal usage of 
a macro you're interested in, and just expand that.


Also:

https://docs.racket-lang.org/macro-debugger/index.html

https://docs.racket-lang.org/reference/Expanding_Top-Level_Forms.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/5133ad54-6c26-5aa8-44e7-53b69bb96342%40neilvandyke.org.


[racket-users] See expanded code?

2019-08-16 Thread Josh Rubin

I always try to understand things from the bottom up.
How can I see the expansion of things likeĀ  (match ...)?
More generally, how do Racket developers look at the internal forms of 
programs?



--
Josh Rubin
jlru...@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/b86a875a-51e6-3855-1f10-12d63c1451fb%40gmail.com.


[racket-users] Racket News - Issue 14

2019-08-16 Thread Paulo Matos
Racket News issue 14 is here.
https://racket-news.com/2019/08/racket-news-issue-14.html

Enjoy!

-- 
Paulo Matos

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/05377b52-dc75-09ce-97b6-5c9734bbaec3%40linki.tools.