definitions in expression context for guile
403b71b344bc — Linus Björnstam 1 year, 6 months ago
Fixed new-cond
06899ac8e933 — Linus Björnstam 1 year, 6 months ago
Updated examples and readme


browse log



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 def))
(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 ...).

#Supported forms

The bodies of begin, lambda, define, let, let*, letrec, letrec*, case and cond are transversed and transformed.


This is a module-local transformation, thus macros imported from other modules don't allow this transformation.


The macros are currently written in syntax-rules. If that isn't supported in your scheme, then tough luck.


Permissified ISC.


There is none.