[plt-scheme] Scheme sources readability

From: Noel Welsh (noelwelsh at gmail.com)
Date: Sun Sep 7 13:55:06 EDT 2008

On Sun, Sep 7, 2008 at 3:48 PM,  <kbohdan at mail.ru> wrote:

> What about docstrings,

Replaced by Scribble in PLT Scheme

> design patterns (like GoF),

Regarding GoF:

http://people.csail.mit.edu/gregs/ref-dyn-patterns.html

"This paper explores how the patterns from the "Gang of Four", or
"GOF" book, as it is often called, appear when similar problems are
addressed using a dynamic, higher-order, object-oriented programming
language. Some of the patterns disappear -- that is, they are
supported directly by language features, some patterns are simpler or
have a different focus, and some are essentially unchanged."

There are still patterns in Scheme and other functional languages.
E.g. fold, zipper, monad etc. Often they are published as "Functional
Pearls".  Generally we try to replace patterns with code.


> coding conventions. Are those non-applicable to scheme ?

There are many conventions.  Here are some low-level ones:

A function that operates on a type foo is called foo-something.  E.g.
foo-load might load a foo from a file.

A function ending in a ? returns #t or #f

A function that converts foos to bars is called foo->bar


Here are some conventions on a higher level (many Untyped specific):

The main file in the collection is called main.ss

There is a file called base.ss that defines the exceptions raised by
this collection

There is a file called test-base.ss that re-exports the version of
SchemeUnit in use and defines any testing utilities

There is a file called all-tests.ss that collects all the tests for
the collection

Module foo.ss has tests in foo-test.ss, which exports all-foo-tests

and so on...


HTH,
N.


Posted on the users mailing list.