Also, I've just noted that now (ice-9 nice-9) exports only 8 bindings, so
there's surely a slot for defining some new ones.

Perhaps it would make sense to liberate letrec or letrec-syntax, so that it
would be possible to use it in a manner similar to let and letrec. However,
I don't think that using letrec in programs is ever a good taste. I'd
personally prefer to use internal "define", because it is much more
readable. As to letrec-syntax, there'd clearly be a little point in
defining recursive macros that have only a single syntax-rule clause.

Some time ago [1], I presented a following form:

(publish
 (define (f x) .... (g x) ....)
 where
 (define (g x)
   ....))

It is useful if one wants to define a few functions that are externally
visible, that share a common internal definition, but it also improves
readability when one defines even a single function that makes use of some
internal definitions. For example, I dare to claim that the usage shown
above is more readable than

(define (f x)
  (define (g x)
    ....)
  .... (g x) ....)

because the extent of internal definition is more apparent, and the body of
external definition is more concise. This is especially visible when there
are more internal definitions. If anyone's interested to see how the
publish-heavy code looks like, it can be viewed in [2].

So anyway, if anyone thinks that it could make sense, then I could add this
"publish" form to the (ice-9 nice-9) module, so that it would export
exactly 9 macros.

Or maybe anyone has a better idea?

[1] https://lists.gnu.org/archive/html/guile-user/2014-01/msg00002.html
[2]
https://bitbucket.org/panicz/slayer/src/cbfb3187edaba890b12b307d84bb9c4538407d20/tools/ply23d.scm?at=default

Reply via email to