Skip to content

Instantly share code, notes, and snippets.

@3b
3b / .lisp
Created June 6, 2019 10:09
Don't know how to ensure validity of #<SB-KERNEL:STRUCTURE-CLASSOID BAR> (not a STANDARD-CLASSOID) for SUBTYPEP.
(defstruct foo
(a 0.0 :type single-float))
(defstruct (bar (:include foo)))
(defstruct foo
(a 0.0d0 :type double-float)) ;; pick continue restart
(compile nil '(lambda () (defstruct (bar (:include foo)))))
@3b
3b / .lisp
Created May 24, 2019 05:25
adler32
(declaim (ftype (function
(octet-vector fixnum (unsigned-byte 16) (unsigned-byte 16))
(values (unsigned-byte 16) (unsigned-byte 16) &optional))
adler32))
(defun adler32 (buf end s1 s2)
(declare (type octet-vector buf)
(type (unsigned-byte 16) s1 s2)
(optimize speed))
Rank Name Self% Cumul% Total%
1 "foreign function ZwWaitForSingleObject" 44.70 44.70 44.70
2 "foreign function NtWaitForMultipleObjects" 33.52 33.52 78.22
3 "foreign function ZwReadFile" 11.20 11.20 89.42
4 PNGLOAD::UNFILTER-ROW 3.18 3.18 92.60
5 (LABELS CHIPZ::DECODE-VALUE :IN CHIPZ::%INFLATE-STATE- 1.51 1.51 94.11
6 (FLET CHIPZ::FROB-BY-COPYING-FROM :IN CHIPZ::%INFLATE- 1.47 1.47 95.58
7 (LABELS CHIPZ::ENSURE-BITS :IN CHIPZ::%INFLATE-STATE-M 0.59 0.59 96.16
8 SB-VM::GENERIC-+ 0.47 0.47 96.63
9 CHIPZ::UPDATE-ADLER32 0.31 0.31 96.94
@3b
3b / gist:1224162
Created September 17, 2011 17:31
rotation
Marble.Marble.prototype.tick = function()
{
var rotateSpeed = 2 * Math.PI/180;
//if( key.right ) this._ballMesh.rotation.z -= rotateSpeed;
//if( key.up ) this._ballMesh.rotation.x -= rotateSpeed;
//if( key.left ) this._ballMesh.rotation.z += rotateSpeed;
//if( key.down ) this._ballMesh.rotation.x += rotateSpeed;
// apply friction
@3b
3b / gist:930929
Created April 20, 2011 10:20
mutiple lisps in slime
(setq slime-lisp-implementations
`((sbcl ("~/lisp/clbuild/clbuild" "--implementation" "sbcl" "lisp"))
;(ccl ("~/lisp/clbuild/clbuild" "--implementation" "ccl" "lisp"))
(ccl ("~/bin/ccl64"))
(ccl32 ("~/bin/ccl"))
(acl ("~/lisp/acl82.64/alisp"))
(abcl ("/usr/bin/java" "-jar" "~/lisp/abcl-bin-0.23.1/abcl.jar"))
(clisp ("clisp" "-K" "full"))
(ecl ("ecl"))