 USING: hashtables io io.streams.plain io.streams.string
 colors summary make accessors splitting math.order
 kernel namespaces assocs destructors strings sequences
-present ;
+present fry ;
 IN: io.styles
 
 GENERIC: stream-format ( str style stream -- )


: format-column ( seq ? -- seq )
    [
        [ 0 [ length max ] reduce ] keep
        swap [ CHAR: \s pad-right ] curry map
    ] unless ;

: map-last ( seq quot -- seq )
    [ dup length <reversed> ] dip [ 0 = ] prepose 2map ; inline

: format-table ( table -- seq )
    flip [ format-column ] map-last

M: input summary
    [
        "Input: " %
        string>> "\n" split1
        [ % ] [ "..." "" ? % ] bi*
    ] "" make ;

: write-object ( str obj -- ) presented associate format ;
