added licence blub
Added a chezscheme (almoste r6rs) version
Changed letrec to letrec*, which should make it more portable
A small utility macro to allow defines in expression context of function bodies. Install it in your site-dir and import it using (use-modules (syntax define))
(use-modules (syntax define))
(define (divide-minus-one a b)
(when (= b 1) (error "We don't allow that here"))
(define b* (- b 1))
(/ a b*))
This transforms all defines in expression context to (letrec ...).
guile-3 famously has definitions in some expression contexts. This expands on that (definitions in cond clauses and so on), and should also work just fine in guile 2.2 - albeit at a performance cost because internal definitions and letrec is slower in guile2.
The bodies of lambda, define, let, let*, letrec, letrec*, when, unless, case, and cond are transversed and transformed.
begin is NOT supported. This is due to begin being spliced if in the top-level.
This is a module-local transformation, thus macros imported from other modules don't allow this transformation. Say, for example (ie-9 match), srfi-11, (ice-9 receive). For guile-3 many of these will work anyway, but will fail in guile-2.2.
The macros are currently written in syntax-rules. If that isn't supported in your scheme, then tough luck.
Permissified ISC.
There is none.