Skip to content

Instantly share code, notes, and snippets.

View shirok's full-sized avatar

Shiro Kawai shirok

View GitHub Profile
(define (ack m n)
(cond ((zero? m) (+ n 1))
((zero? n) (ack (- m 1) 1))
(else (ack (- m 1) (ack m (- n 1))))))
#|
gosh> (time (ack 3 10))
;(time (ack 3 10))
; real 6.488
; user 6.480
cl-user> (defun foo (a j)
(declare (optimize (safety 0) (speed 3))
(type (array (unsigned-byte 8)) a))
(let ((ptr (excl::ll :+ a #.(sys::mdparam 'comp::md-lvector-data0-norm)))
(off (excl::ll :fixnum-to-mi j)))
(declare (fixnum ptr off))
(excl::ll :aset-byte ptr off
(excl::ll :- (excl::ll :aref-ubyte ptr j) (excl::ll :fixnum-to-mi 1)))))
foo
cl-user> (compile 'foo)
@shirok
shirok / gist:732333
Created December 7, 2010 20:16
classmethod idea w/mop
(defpackage :clap-metas)
(defclass clap-metas::clap-base--meta (standard-class) ())
(defmethod clos:ensure-class-using-class :around ((class null) name
&rest options
&key metaclass
direct-superclasses
&allow-other-keys)
(when (not metaclass)