Use fry in io.styles

db4
Slava Pestov 2009-01-25 22:56:47 -06:00
parent b95a587ce1
commit 6e2f60729f
1 changed files with 6 additions and 6 deletions

View File

@ -3,7 +3,7 @@
USING: hashtables io io.streams.plain io.streams.string USING: hashtables io io.streams.plain io.streams.string
colors summary make accessors splitting math.order colors summary make accessors splitting math.order
kernel namespaces assocs destructors strings sequences kernel namespaces assocs destructors strings sequences
present ; present fry ;
IN: io.styles IN: io.styles
GENERIC: stream-format ( str style stream -- ) GENERIC: stream-format ( str style stream -- )
@ -118,12 +118,12 @@ M: plain-writer make-block-stream
: format-column ( seq ? -- seq ) : format-column ( seq ? -- seq )
[ [
[ 0 [ length max ] reduce ] keep dup [ length ] map supremum
swap [ CHAR: \s pad-right ] curry map '[ _ CHAR: \s pad-right ] map
] unless ; ] unless ;
: map-last ( seq quot -- seq ) : map-last ( seq quot -- seq )
[ dup length <reversed> ] dip [ 0 = ] prepose 2map ; inline [ dup length <reversed> ] dip '[ 0 = @ ] 2map ; inline
: format-table ( table -- seq ) : format-table ( table -- seq )
flip [ format-column ] map-last flip [ format-column ] map-last
@ -178,8 +178,8 @@ M: input present string>> ;
M: input summary M: input summary
[ [
"Input: " % "Input: " %
string>> "\n" split1 swap % string>> "\n" split1
"..." "" ? % [ % ] [ "..." "" ? % ] bi*
] "" make ; ] "" make ;
: write-object ( str obj -- ) presented associate format ; : write-object ( str obj -- ) presented associate format ;