I’m grading code, and one of my students keeps leaving out spaces in weird 
places:

(cond
  [(< x 3)(+ x 1)]
  [else (f(g 9))])

I took a quick look in the style guide, and it doesn’t seem to have much to say 
about this. Here’s what it has:

6.8 Spaces

Don’t pollute your code with spaces at the end of lines.

If you find yourself breaking long blocks of code with blank lines to aid 
readability, consider refactoring your program to introduce auxiliary functions 
so that you can shorten these long blocks of code. If nothing else helps, 
consider using (potentially) empty comment lines.

***

To this text, I would like to add:

“Every pair of expressions on a line should have at least one space between 
them, even if they’re separated by parens.

Wrong: [(< x 3)(+ x 1)]
Right: [(< x 3) (+ x 1)]

Wrong: (f(g 3))
Right: (f (g 3))


Can anyone think of exceptions to this? One possible nit: since the rule refers 
to “expressions”, it perhaps wouldn’t rule out (define(f x)3) . You could say 
“term”, but I think it would be less clear.

John



-- 
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/22028833-9d60-4d2e-9c6b-ae35d55abdf0%40mtasv.net.

Reply via email to