misc: starting Turing Machine in Racket.
This commit is contained in:
parent
05a88c1a29
commit
b6e24b44ad
|
@ -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)))
|
Loading…
Reference in New Issue