     ] each 
     bytes ;
 
-:: inflate-dynamic ( bitstream -- bytes )
-    bitstream decode-huffman-tables
-    bitstream '[ _ swap <huffman-decoder> ] map :> tables
+:: inflate-huffman ( bitstream tables -- bytes )
+    tables bitstream '[ _ swap <huffman-decoder> ] map :> tables
     [
         tables first read1-huff2
         dup 256 >

    { } [ dup array? [ dup first 16 = ] [ f ] if [ [ unclip-last ] [ second 1 + swap <repetition> append ] bi* ] [ suffix ] if ] reduce
    [ dup array? [ second 0 <repetition> ] [ 1array ] if ] map concat
    nip swap cut 2array [ [ length>> [0,b) ] [ ] bi get-table ] map ;
    
CONSTANT: length-table
    {
        3 4 5 6 7 8 9 10

    bitstream bytes>> <slice>
    len 8 * bitstream bs:seek ;

: inflate-dynamic ( bitstream -- bytes ) 
    dup decode-huffman-tables inflate-huffman ;

: inflate-static ( bitstream -- bytes ) 
    static-huffman-tables inflate-huffman ;

:: inflate-loop ( bitstream -- bytes )
    [ 1 bitstream bs:read 0 = ]
