Re: [racket-users] Racket Echo Server/Client hanging

2017-12-05 Thread Vishal Prasad
Jon,

Thanks!

-Vishal

On Wednesday, December 6, 2017 at 12:19:07 AM UTC-5, Jon Zeppieri wrote:
>
>
>
> On Wed, Dec 6, 2017 at 12:13 AM, Vishal Prasad  > wrote:
>
>> And this is the client:
>>
>>
>> (define (hello_socket port)
>> (define-values (in out) (tcp-connect "localhost" port))
>> (write "hello socket world\n" out)
>> (display (read in)))
>>
>>
>> The client does not receive any text back, and just hangs on the read. 
>>
>>
>> The `write` is buffered. If you add a `(flush-output out)`, it will work.
>
> - Jon 
>

-- 
You received this message because you are subscribed to the Google 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] Racket Echo Server/Client hanging

2017-12-05 Thread Jon Zeppieri
On Wed, Dec 6, 2017 at 12:13 AM, Vishal Prasad  wrote:

> And this is the client:
>
>
> (define (hello_socket port)
> (define-values (in out) (tcp-connect "localhost" port))
> (write "hello socket world\n" out)
> (display (read in)))
>
>
> The client does not receive any text back, and just hangs on the read.
>
>
> The `write` is buffered. If you add a `(flush-output out)`, it will work.

- Jon

-- 
You received this message because you are subscribed to the Google 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] Server: Racket

2017-12-05 Thread jesse
I'm pleased to announce a new (e)book my mine that may be of interest to 
Racket programmers. It's called *Server: Racket—Practical Web Programming 
with the Racket HTTP Server*. 

I wrote the book to help those who are interested in doing web programming 
in Racket. (If you've already done lots of web programming in Racket, 
there's likely very little in the book for you.) It's a suite of tutorials 
on a variety of bread-and-butter topics in web programming. It assumes some 
knowledge of Racket (it's not really an introduction to the language), but 
not much. My ultimate goal is to to make Racket more widely used in web 
programming. Racket is, in my view, advanced technology and deserves more 
attention, in general, and I believe that an investment in Racket can pay 
dividends on the web, in particular.

Web devel is a big umbrella; many things fall under it in one way or 
another, and one has to set boundaries to keep the discussion from becoming 
unwieldy. *Server: Racket* is largely devoted to the task of laying out 
what it takes to build HTTP APIs in Racket, though it does also discuss 
traditional topics such as HTML form processing and generating HTML, too. 
The book does not (in its current form, anyway) exploit a central feature 
of Racket, namely, the ease of crafting languages to solve problems. Most 
of the book is, in other words, "racket racket"; it belongs more in the 
"batteries included" part of the Racket picture, and not so much in the 
"make a language" part.

You can learn more at http://serverracket.com, where you can find the table 
of contents to get a sense of the scope of the book, as well as a sample 
chapter to get a sense of the style and approach.

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


[racket-users] Racket Echo Server/Client hanging

2017-12-05 Thread Vishal Prasad
 

Really embarrassed I can't figure out what's going on here, but I just 
spent the last two hours banging my head against this going nowhere.


I'm trying to create a simple echo server and client in Racket.


This is the server:


(define (hello_listen port)
(define listener (tcp-listen port))
(define (loop)
(define-values (in out) (tcp-accept listener))
(thread (lambda ()
(copy-port in out)
(close-output-port out)))
(loop))
(loop))


And this is the client:


(define (hello_socket port)
(define-values (in out) (tcp-connect "localhost" port))
(write "hello socket world\n" out)
(display (read in)))


The client does not receive any text back, and just hangs on the read. 

When I write a simple client in Python however, the behavior is fine:


>>> import socket
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> s.connect(('localhost', ))
>>> s.send("hi")   
2
>>> s.recv(500)
'hi' 

What am I missing here in the Racket client code?

-- 
You received this message because you are subscribed to the Google 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] Nested quasiquote

2017-12-05 Thread Thomas Gilray
Is there a reason why Racket's match doesn't seem to currently support
nested quasiquote?

> (define x 1)
> `(`(,x ,,x))
'(`(,x ,1))
> (match `(`(,x ,,x))
  [`(`(,x ,,x)) x])
. match: syntax error in pattern in: (unquote x)

--
Thomas

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


Re: [racket-users] Trying to prove a property of a semantics for logic (Prolog-like) programs: could Redex help?

2017-12-05 Thread Vincent Nys
So many reasons to dig into things I've wanted to look at for a while!

Op dinsdag 5 december 2017 18:23:37 UTC+1 schreef Matthias Felleisen:
>
>
> You may also wish to look into Rosette, a Racket-based SMT DSL. Emina 
> Torlak is the creator and you should be able to find it from her web site — 
> Matthias
>
>
>
>
> On Dec 5, 2017, at 1:37 AM, Vincent Nys  
> wrote:
>
> Matthias,
>
> Thank you for your input. I will look into enlisting a proof assistant.
>
> Regards,
>
> Vincent
>
> Op maandag 4 december 2017 19:23:16 UTC+1 schreef Matthias Felleisen:
>>
>>
>> > On Dec 4, 2017, at 9:47 AM, Vincent Nys  wrote: 
>> > 
>> > Hi, 
>> > 
>> > I'm currently working on a program transformation technique for logic 
>> programs. The technique uses abstract interpretation, so I have an abstract 
>> program semantics and the main operation is an abstraction of resolution. I 
>> would like to prove a particular property of this semantics (namely that 
>> the number of non-equivalent abstract conjunctions that can be obtained 
>> through resolution is finite unless there are recursive calls which can be 
>> characterized in a specific way). I can't seem to do it by hand. Would 
>> Redex be of help if I used it to code an interpreter for these abstract 
>> semantics? I don't necessarily mean that it should produce a complete 
>> proof, but, for example, could it demonstrate that the property holds for a 
>> logic program with at most N clauses of length L, where neither is 
>> symbolic, by exhausting a search space? 
>>
>>
>> Let me first clarify a misunderstanding. Redex is not really a tool for 
>> writing an interpreter. If you want to write interpreters, use Racket or 
>> Typed Racket. Redex is a tool for specifying either a reduction semantics 
>> or a relation semantics. It’s unique for the former and one among others 
>> for the latter. 
>>
>> Let me then state a surprising admission. Even though I started as a 
>> Prologer and have always thought of reduction semantics as a unique and 
>> amazing tool for specifying a semantics, I have never done so for a logic 
>> language. Interesting. 
>>
>> Now as to your question, Redex can check things but it’s hard to prove 
>> them, even for finite cases. In the past some of my PhD students have 
>> developed Redex model to experiment with a semantics and Isabelle/Coq 
>> proofs to prove things. Modeling in Redex tends to be fast and easy; it 
>> really feels like it imposes only a slightly higher overhead than 
>> paper-and-pencil modeling. 
>>
>> Many wish that proof systems and Redex were more integrated. Alas they 
>> are not. 
>>
>> — Matthias 
>>
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users...@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] Call for Participation: BOB 2018 (February 28, Berlin)

2017-12-05 Thread Michael Sperber

Note that Leif Andersen is doing a Racket-based keynote!



   BOB 2018
  Conference
 “What happens if we simply use what’s best?”
  February 23, 2018, Berlin
   http://bobkonf.de/2018/
   Program:
http://bobkonf.de/2018/en/program.html
Registration:
 http://bobkonf.de/2018/en/registration.html
   


BOB is the conference for developers, architects and decision-makers
to explore technologies beyond the mainstream in software development,
and to find the best tools available to software developers today. Our
goal is for all participants of BOB to return home with new insights
that enable them to improve their own software development
experiences.

The program features 14 talks and 8 tutorials on current topics:

http://bobkonf.de/2018/en/program.html

The subject range of talks includes functional programming,
verticalization, formal methods, and data analytics.

The tutorials feature introductions to Haskell, Clojure, Livecoding,
terminal programming, Liquid Haskell, functional reactive programming,
and domain-driven design.

Leif Andersen will give the keynote talk.

Registration is open online:

http://bobkonf.de/2018/en/registration.html

NOTE: The early-bird rates expire on January 22, 2018!

BOB cooperates with the :clojured conference on the following
day. There is a registration discount available for participants of
both events.

http://www.clojured.de/

-- 
You received this message because you are subscribed to the Google 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.