(require racket)
(require racket/base)
(struct person (name age college) #:transparent)
(define p1 (person 'john 23 'yale))
(define p2 (person 'mary 20 'yale))
p1
p2
(person-name p1)
(person-age p1)
(person-college p2)
(equal? p1 p2)
(equal? p1 p1)
(equal? p1 (person 'john 23 'yale))
(= p1 (person 'john 23 'yale))
(person? p1)
(person? 'p1)
An instruction is a 5-tuple
(struct ins (c-state c-symbol n-state n-symbol dir) #:transparent)
(struct ins (c-state c-symbol n-state n-symbol dir) #:transparent)
A configuration is a current state, a head position, and a tape
(struct conf (state ltape symbol rtape) #:transparent)
(struct conf (state ltape symbol rtape) #:transparent)
A tape is just a list of symbols
(define tape1 '(1 1 0 1 0))
(define tape2 '(b 1 1 b 0 1 1 b b))
(define config1 (conf 'q1 '(0 1) 0 '(1 1)))
(conf-state config1)
(conf-symbol config1)
(conf-ltape config1)
(conf-rtape config1)
(define tm1
(list
(ins 'q1 0 'q1 1 'R)
(ins 'q1 1 'q1 0 'R)
(ins 'q1 'b 'q2 'b 'L)
(ins 'q2 0 'q2 0 'L)
(ins 'q2 1 'q2 1 'L)
(ins 'q2 'b 'q3 'b 'R)))