John Clements
unread,Jan 21, 2020, 1:13:40 AM1/21/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Racket-Users List
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