Skip to content

Instantly share code, notes, and snippets.

;; TODO: This function really needs some documentation. It is used to
;; partition a pile of forms in a list into group based upon a categorization
;; function.
(defun sieve (pred sequ &key (key #'identity)
(collector nil)
(values t)
(pred-range-sort nil)
(initial-key-pool nil) ;; ensure all buckets present!
(result-transformer-func #'identity)
(eval-when (:compile-toplevel :load-toplevel :execute)
(defparameter *regdb*
(let ((data
`(;; register symbol names as values
(regsyms-gp8 (al cl dl bl ah ch dh bh))
(regsyms-gp8-ext (spl bpl sil dil r8b r9b r10b r11b r12b
r13b r14b r15b))
(regsyms-gp16 (ax cx dx bx bp si di))
(regsyms-gp16-ext (r8w r9w r10w r11w r12w r13w
r14w r15w))
(defun parse-number (str &key (package *package*) (error nil))
(with-standard-io-syntax
(with-input-from-string (s str)
(let ((*read-eval* nil)
(*package* package))
(let ((val
(restart-case
(handler-bind
((condition (lambda (c)
(invoke-restart 'bad-read error))))
(defparameter *inst* nil)
(defun ast->3ac-helper (ast)
(if (atom ast)
(cond
((numberp ast)
ast)
((symbolp ast)
ast)
(t
(error "oops, don't know what this is")))
(defun probability-choice (lst)
"Expect LST to be ((prob item) (prob item) ...). It doesn't have to be
sorted but all PROB values must sum to 1. Return a random item based on these
probabilities."
(let ((tol 1d-10)
(prob-sum (reduce #'+ lst :key #'car)))
(assert (<= (- 1d0 (abs prob-sum)) tol)))
(format t "Probabilities are good.~%")
Type BLInst
Field N:UInt = 1024 * 1024 * 5 ' number of Lisp objects (doubles) to store
Field hp:ULong = 0 ' heap pointer
Field sp:ULong = N ' stack pointer
Field cell:Double[N]
Field nil_val:Double
Field quit_val:Double
Field tru_val:Double
Field err_val:Double
(logior
sdl2-ffi:+SDL-INIT-TIMER+
sdl2-ffi:+SDL-INIT-AUDIO+
sdl2-ffi:+SDL-INIT-VIDEO+
sdl2-ffi:+SDL-INIT-JOYSTICK+
sdl2-ffi:+SDL-INIT-HAPTIC+
sdl2-ffi:+SDL-INIT-GAMECONTROLLER+
sdl2-ffi:+SDL-INIT-EVENTS+
sdl2-ffi:+SDL-INIT-SENSOR+)
;; disable floating point traps
(eval-when (:load-toplevel :execute)
(sb-int:set-floating-point-modes :traps nil))
(asdf:load-system :cl-cffi-gtk)
(defpackage :gtk-tutorial
(:use :gtk :gdk :gdk-pixbuf :gobject
:glib :gio :pango :cairo :cffi :common-lisp))
+-----------------------------------------------------------------------------+
|sm1#bibp |
|# MlA#Ls |
|c tep |
|t23smecs |
| s |
| c#mm sm |
|m m |
|CCI H |
| |
+-----------------------------------------------------------------------------+
| |
| |
| |
| |
| |
| |
| |
| |
| |