[racket-dev] comments on "comments on learning Racket"

From: Laurent (laurent.orseau at gmail.com)
Date: Sun Apr 27 05:39:50 EDT 2014

On Sun, Apr 27, 2014 at 1:09 AM, Matthias Felleisen <matthias at ccs.neu.edu>wrote:

> ** tab completion must be faster
>

and re-indentation of large parts of files too, if possible.
Currently, re-indenting a 500 lines file can take a few seconds.


> ?? I don't get the "Uniform syntax is harder to read" comment. More
>    highlighting, hmph?
>

Maybe it's just that he's not used to prefix bracketed syntax. That
certainly demands a bit of training.
Also, because Racket makes extensive use of long-and-clear words, maybe it
is comparable to reading a math formula (non-racket) and reading the same
formula using words (racket): If you know how to read a formula (know what
all the symbols mean, etc.), it can be much faster than reading the verbose
form.

** I do get jealous when I see
>
>  [(i, j, k) | i <- [1..10], j <- [i..10], k <- [j..10], i^2 + j^2 == k^2]
>
> vs
>
> (for*/list ([i (range 1 20)] [j (range i 20)] [k (range j 20)] #:when (=
> (+ (sqr i) (sqr j)) (sqr k)))
>     (list i j k))
>

Would you be less jealous reading the following?

(for*/list ([i (.. 1 20)] [j (.. i 20)] [k (.. j 20)] #:when (= (: i ^ 2 +
j ^ 2) (: k ^ 2))
  (list i j k))

or is it really the #:when part that you'd have preferred to be treated on
par with the rest, as in Haskell? (or the one-liner?)

** Do we need to add these to our library?
>
> ;; (X ... -> Y ...) X *-> [List-of Y]
> (define (gather-return-values f . s)
>   (call-with-values (lambda () (apply f s)) list))
>
> ;; Nat (X ... -> Y ...) X *-> Y
> (define (nth-return-value i f . s)
>   (call-with-values (lambda () (apply f s)) (lambda l (list-ref l i))))
>

I've been having a need of these functions on several occasions myself too.
(Although the names are too long, but maybe just omitting `return` would be
acceptable to my taste.)


> ** Printing is brutally expensive in DrRacket. Is there a way to make it
>    cheaper?
>

(maybe use some buffering, like wait at least 0.2 seconds before printing,
instead of printing everything right away?)


> ;;
> -----------------------------------------------------------------------------
>
> [1] What do we call the thing that shows up at the top right?
>

I think Robby calls them the blue-boxes?


> ;;
> =============================================================================
> PART II
>


> ** "Why, why must everything be Inferior By Default?"
>
>    We obviously need a 'syntax story' that takes readers directly from
>    define-syntax-rule to syntax-parse, bringing in hygiene only late, when
> it
>    truly matters to raise expressiveness
>

Why not use `define-simple-macro` and completely ditch `define-syntax-rule`
from the guide?

He could then have gone from
(define-simple-macro (swap x y) ....)
to
(define-simple-macro (swap x:id y:id) ....)
in no time.

** "For some reason I was thinking that indentation information is somehow
>    stored with functions/macros themselves. I was wrong."
>
>    We discussed this years ago. Hmph, he thought so too.
>

I'd also have preferred that (but it's easier to say than to do, obviously).
This would allow users to define their own indentation rules for their own
forms, and possible re-define it for old forms, but that is more debatable.
Thanks to submodules, it could be loaded only when used, e.g. by DrRacket.

** "I'm afraid that with the level of flexibility Racket allows, I'll never
> get
>    to writing an actual program – most likely I'll be spending my time
> improving
>    Racket itself (well, or at least changing it to suit my tastes)."
>
>    Well, I went there when I was young and saw macros. Who hasn't?
>

I remember the time when I first thought "Oh my, Racket is the most
powerful language in the world!". Quite a enlightenment moment.

On Sun, Apr 27, 2014 at 2:38 AM, Sam Tobin-Hochstadt
<samth at cs.indiana.edu>wrote:

> Ok, I think we agree then. What I'm proposing is that new DrRacket
> installations should start in a mode where `#lang racket (+ 3 4)`
> works, which is not currently the case.
>

Completely agree on that.
Also, maybe the Language preferences should be accessible from the
"Edit/Preferences" panel, or at least be listed right under, in
"Edit/Language preferences".

Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20140427/e27154d6/attachment.html>

Posted on the dev mailing list.