From b6e24b44add6ba816f527cc072461a3c889f5c21 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Sat, 7 Apr 2018 12:55:27 -0700 Subject: [PATCH] misc: starting Turing Machine in Racket. --- misc/turing.rkt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 misc/turing.rkt diff --git a/misc/turing.rkt b/misc/turing.rkt new file mode 100644 index 0000000..24013ad --- /dev/null +++ b/misc/turing.rkt @@ -0,0 +1,18 @@ +#lang racket + +;;; a turing machine implementation +(define tape (make-hash)) + +(define (lookup position) + (unless (hash-has-key? tape position) + (hash-set! tape position 0)) + (hash-ref tape position)) + +(define turing-machine% + (class object% + (init) + (define tape (make-hash)) + (define head 0) + (define current-state #f) + (define state-table) + (super-new)))