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
+-----------------------------------------------------------------------------+ | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
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
(defclass bsm-mapid-table () | |
((%by-key :reader by-key | |
:initarg :by-key | |
:initform nil) | |
(%by-value :reader by-value | |
:initarg :by-value | |
:initform nil))) | |
(defun bsm-make-bsm-mapid-table (by-key-test by-value-test) | |
(bsm-mapid-table :by-key (make-hash-table :test by-key-test) |
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
(c:define-texture-map g000-1d-phy-gnd-one-non (:1d :unique) | |
(c:data-elements | |
(0 (c:image-element :logloc (textures 1d-64x1)))) | |
(c:mipmap-1d | |
:extent (c:span-1d :origin 0 :extent 64) | |
(c:mapping-span-1d :to (c:data-span-1d :origin 0 :extent 64) | |
:from (c:data-span-1d :origin 0 :extent 64 :elidx 0)))) | |
;; - | |
;; | | |
;; | The same grounded form as above, but built from programmatic API. |
NewerOlder