Great comments. Thank-you!

I think that for the purposes of remembering "take and drop family
functions are backwards / wrong" should suffice, or train myself to think
"from list L take n elements", etc.

Another point that occurred to me is that the common library naming
convention of object-fn (e.g. string-ref) is helpful in prompting the
object-first ordering.

In terms of designing functions another thing I've learned to appreciate
from the standard libraries is the use of keyword arguments with sensible
defaults. Loosely speaking, anything beyond "what reads naturally"
(typically 2 or 3 arguments) seems to work better when tagged with a
keyword.

For example:

(define test-scores '((math 84) (english 77) (comp-sci 106) (physics 68)))
(sort test-scores < #:key second)


This is friendlier to the reader / author than a more concise e.g. (sort
test-scores < second), so  I've learned to follow a similar convention in
designing my own functions.

Is this mentioned explicitly somewhere, e.g. in HTDP? [Perhaps I'm missing
other helpful conventions.]

Dan

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to