On Wed, Aug 21, 2019 at 02:55:46AM -0700, Chris Stephenson wrote:
> Parantheses and learners - experience with 14-18 year olds
...
...
> 
> Do we have parenthesis problems?
> 
> Yes. Worse for students with previous programming experience. We solved 
> them by educating our students in the clues given by drRacket - colouring 
> matching parenthesis. But the most useful trick we taught is to select the 
> whole function and use tab to autoformat it. This immediately makes 
> parenthesis errors obvious. Make of that what you will. Does that mean that 
> an indentation based format would be better? I am not sure.

There are three things here:

 * The notation the language uses for nesting
 * The visual appearance of the code
 * The intentions of the programmer

The problem exists when these conflict.

The solution exists when the programmer can see that his intentions to 
not match the code.

Autoformatting the function accomplishes this by making the appearance 
match the language's notation.  Especially if it's easy to do.
Letting the editor signal mismatches between indentation and semantics 
is also effective.
Colouring the brackets helps for bracket clusters within a line.

Hand-indenting (as in Python) also accomplishes this, but is more work.

But an additional effective technique is to enable notation for 
tail-nesting parentheses, so there are fewer physical parentheses to 
match up.

e.g. (a b ; c d ; e f) for (a b (c d (e d)))

Or 
( a b
; c d
; e f)

but Racket would need another character than ';' for this.  Are there 
any left?

-- hendrik

-- 
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/20190821145714.e6ipvxvppvkxn3y3%40topoi.pooq.com.

Reply via email to