Episode 13: Friction
author |
Steve Losh <steve@stevelosh.com> |
date |
Tue, 19 Apr 2016 15:56:35 +0000 |
parents |
2278039315fa |
children |
69f98eb3a1df |
(in-package #:coding-math.utils)
(defun dividesp (n divisor)
"Return whether `n` is evenly divisible by `divisor`."
(zerop (mod n divisor)))
(defmacro mulf (place n &environment env)
"Multiply `place` by `n` in-place."
(multiple-value-bind (temps exprs stores store-expr access-expr)
(get-setf-expansion place env)
`(let* (,@(mapcar #'list temps exprs)
(,(car stores) (* ,n ,access-expr)))
,store-expr)))
(defun a (alist key) ; lol
(cdr (assoc key alist)))
(defmacro in-context (&body body)
`(prog1
(push-matrix)
(progn ,@body)
(pop-matrix)))