[plt-dev] Racket web page
On 05/25/2010 03:04 PM, Carl Eastlund wrote:
> On Tue, May 25, 2010 at 4:51 PM, Jon Rafkind<rafkind at cs.utah.edu> wrote:
>
>> Since all the code is extremely public can I make a strong request that
>> variable names not be single letter characters? Some short word would be
>> preferable.
>>
>> I'm willing to fix all the code (assuming its in svn/git somewhere) if no
>> one feels like updating the examples.
>>
> With 7 lines and about 40-some characters per line, it's really hard
> to write code that reads like a novel. Short variable names are a
> tool of the trade. Heck, the little blurb that the "?" link opens has
> more room to explain what the variables are for than the code itself
> does.
>
> --Carl
>
#lang racket
(define listener (tcp-listen 12345))
(let echo-server ()
(define-values (i o) (tcp-accept listener))
(thread (lambda () (copy-port i o)
(close-output-port o)))
(echo-server))
I count 11 unique "novel"-esque variables in that example, and only 2
"tools of the trade" variables. I think this is a reasonable mapping to
go from short to long:
o -> out
i -> in