(in-package :tsdb) (setf *redwoods-shift* (with-open-file (stream (logon-file "uio/wescience" "map.txt")) (loop with map = (make-hash-table) for line = (read-line stream nil nil) while line do (multiple-value-bind (start end starts ends) (ppcre:scan "^([0-9]+) -> ([0-9]+):" line) (declare (ignore start end)) (when (and starts ends) (let ((old (parse-integer line :start (aref starts 0) :junk-allowed t)) (new (parse-integer line :start (aref starts 1) :junk-allowed t))) (when (and old new) (setf (gethash (- new 10) map) old))))) finally (return #'(lambda (new) (let ((old (gethash new map))) (format t "shift(): ~a --> ~(~a~).~%" new old) (force-output t) old))))))