This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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"))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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.~%") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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+) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; 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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| +-----------------------------------------------------------------------------+ | |
| |sm1#bibp | | |
| |# MlA#Ls | | |
| |c tep | | |
| |t23smecs | | |
| | s | | |
| | c#mm sm | | |
| |m m | | |
| |CCI H | | |
| | | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| +-----------------------------------------------------------------------------+ | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | |
NewerOlder