X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fgacela_misc.scm;h=42c8841f7e0bf132848a09eab5a5b315b1f91a58;hb=023823491bfe1a64e136bcc2d47c6ec5803f23bf;hp=b75a44eb1cf91a4d1c1158db9c754a5c06687b0a;hpb=042f93e750461b4d7235f702c973f0bd1effcae9;p=gacela.git diff --git a/src/gacela_misc.scm b/src/gacela_misc.scm index b75a44e..42c8841 100644 --- a/src/gacela_misc.scm +++ b/src/gacela_misc.scm @@ -15,8 +15,20 @@ ;;; along with this program. If not, see . + +;;; Additional modules + +(use-modules (srfi srfi-1)) + + +;;; Functions + (define (nearest-power-of-two n) (define (power p n) (cond ((> (* p 2) n) p) (else (power (* p 2) n)))) (power 1 n)) + +(define-macro (pushnew elem list) + `(cond ((not (find (lambda (e) (eq? e ,elem)) ,list)) + (set! ,list (cons ,elem ,list)))))