X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=gacela_misc.lisp;h=8a7c2e433242b551ee3fbc6c2c229d142aaf436a;hb=31db8863bd1281f94f426aac5936fb897351362f;hp=6ebcf38ddde8e1e299c8cd68c335a22df38f17d0;hpb=678a1561ca858c34fecf04792831caf68559c2ac;p=gacela.git diff --git a/gacela_misc.lisp b/gacela_misc.lisp index 6ebcf38..8a7c2e4 100755 --- a/gacela_misc.lisp +++ b/gacela_misc.lisp @@ -63,6 +63,12 @@ (cond ((or (numberp list) (numberp pattern)) (and (numberp list) (numberp pattern))) (t t))))) +(defun nearest-power-of-two (n) + (labels ((power (p n) + (cond ((> (* p 2) n) p) + (t (power (* p 2) n))))) + (power 1 n))) + ;Geometry (defun dotp (dot) (match-pattern dot '(0 0)))