diff options
Diffstat (limited to 'src/macros')
-rw-r--r-- | src/macros/macros.sc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/macros/macros.sc b/src/macros/macros.sc index 1ccfeab..4832887 100644 --- a/src/macros/macros.sc +++ b/src/macros/macros.sc @@ -26,6 +26,9 @@ (when (not condition) body ...)) +(sc-define-syntax (incr var) + (set+ var 1)) + (sc-define-syntax (for-i index limit body ...) (for ((define index int 0) (< index limit) @@ -49,6 +52,18 @@ gsl-vector-free body ...)) +(sc-define-syntax (with-matrix var m n body ...) + (with-alloc var gsl-matrix* + (gsl-matrix-alloc m n) + gsl-matrix-free + body ...)) + +(sc-define-syntax (with-square-matrix var n body ...) + (with-alloc var gsl-matrix* + (gsl-matrix-alloc n n) + gsl-matrix-free + body ...)) + (sc-define-syntax (with-rng var body ...) (with-alloc var gsl-rng* (gsl-rng-alloc gsl-rng-default) gsl-rng-free |