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
;; helper functions | |
(defun mklist (obj) | |
"Ensure obj is a list" | |
(if (listp obj) obj (list obj))) | |
(defmacro o (&rest fs) | |
"Macro for composition of functions. Takes a list of functions and produces | |
a closure as expected: | |
(o identity (- 12) 1+) => (lambda (&rest args) (identity (- 12 (1+ ,@args)))) |
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 *tape* '()) | |
(defparameter *deltas* '()) | |
(defparameter *tape-pos* 0) | |
(defparameter *q* 0) | |
(define-condition no-delta (error) | |
((text :initarg :text :accessor text))) | |
(defun final-statep (final-states) | |
"checks whether current state *q* is a final state" |