- (let ((row (string-right-trim "RL" seat-spec))
- (col (string-left-trim "FB" seat-spec))
- (convert-to-int
- (lambda (str one)
- (loop with len = (1- (length str))
- for c across str
- for i downfrom len
- summing (if (char= c one)
- (ash 1 i) 0)))))
- (mapcar convert-to-int (list row col) '(#\B #\R))))
-
-(defun calc-seat-id (row-col)
- (destructuring-bind (row col) row-col
- (+ (* row 8) col)))