From 81b49377edf2d5b08dca4b5ff3132499861244ea Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sat, 8 Jan 2022 12:44:52 +0530 Subject: Bunch of unfinished experiments These experiments were in progress towards the end, and never properly finished. I leave the code here in case it turns out to be useful. --- src/macros/macros.sc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/macros/macros.sc') 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 -- cgit v1.2.3