     ] with-compilation-unit ;
 
 : process-script ( ranges -- )
-    [ values prune \ num>name-table set-value ]
-    [ make-char>num \ char>num-table set-value ] bi
-    num>name-table >symbols \ num>name-table set-value ;
+    dup values prune >symbols interned [
+        expand-ranges \ script-table set-value
+    ] with-variable ;
 
 : load-script ( -- )
     "resource:extra/unicode/script/Scripts.txt"

        ";" split1 [ [ blank? ] trim ] bi@
    ] H{ } map>assoc ;

: set-if ( value var -- )
    dup 500000 < [ set ] [ 2drop ] if ;

: expand-ranges ( assoc -- char-assoc )
    ! char-assoc is code point => name
    [ [
        CHAR: . pick member? [
            swap ".." split1 [ hex> ] bi@ [a,b]
            [ set-if ] with each
        ] [ swap hex> set-if ] if
    ] assoc-each ] H{ } make-assoc ;

: hash>byte-array ( hash -- byte-array )
    [ keys supremum 1+ <byte-array> dup ] keep
    [ -rot set-nth ] with assoc-each ;

: make-char>num ( assoc -- char>num-table )
    expand-ranges
    [ num>name-table index ] assoc-map
    hash>byte-array ;

: >symbols ( strings -- symbols )
    [

load-script
PRIVATE>

SYMBOL: Unknown

: script-of ( char -- script )
    script-table interval-at [ Unknown ] unless* ;
