Simplify a bit

This commit is contained in:
Vivianne 2024-02-26 18:51:51 -05:00
parent 4a76b5d5e9
commit 2e9ef77b32
1 changed files with 5 additions and 6 deletions

View File

@ -318,14 +318,13 @@
(and (ignore (and (? "#") (? (or "x" "0x"))))
hex-chars))
(define (str->channel str)
(let ((v (locale-string->integer str 16)))
(define (terminal->channel term)
(let* ((str (second term))
(val (locale-string->integer str 16)))
;; If one character we act as if it was doubled
(if (= 1 (string-length str))
(+ v (* v 16))
v)))
(define (terminal->channel t) (str->channel (second t)))
(+ val (* val 16))
val)))
(let* ((tree (peg:tree (match-pattern hex-string hex)))
(chs (and tree (map terminal->channel tree))))