prettyprint.backend: can't use locals

db4
Joe Groff 2011-11-23 20:20:27 -08:00
parent 07abeee9d9
commit 13f27f3d9e
1 changed files with 9 additions and 9 deletions

View File

@ -4,7 +4,7 @@ USING: accessors arrays assocs byte-arrays byte-vectors classes
classes.algebra.private classes.intersection classes.maybe
classes.tuple classes.tuple.private classes.union colors
colors.constants combinators continuations effects generic
hash-sets hashtables io io.pathnames io.styles kernel locals
hash-sets hashtables io io.pathnames io.styles kernel
make math math.order math.parser namespaces prettyprint.config
prettyprint.custom prettyprint.sections prettyprint.stylesheet
quotations sbufs sequences strings vectors words words.symbol ;
@ -63,16 +63,16 @@ M: method pprint*
[ "method-generic" word-prop pprint-word ] bi
block> ;
:: pprint-prefixed-number ( n pre quot: ( n -- n' ) -- )
n neg?
[ n neg quot call pre prepend "-" prepend text ]
[ n quot call pre prepend text ] if ; inline
: pprint-prefixed-number ( n quot: ( n -- n' ) pre -- )
pick neg?
[ [ neg ] [ call ] [ prepend ] tri* "-" prepend text ]
[ [ call ] [ prepend ] bi* text ] if ; inline
M: real pprint*
number-base get {
{ 16 [ "0x" [ >hex ] pprint-prefixed-number ] }
{ 8 [ "0o" [ >oct ] pprint-prefixed-number ] }
{ 2 [ "0b" [ >bin ] pprint-prefixed-number ] }
{ 16 [ [ >hex ] "0x" pprint-prefixed-number ] }
{ 8 [ [ >oct ] "0o" pprint-prefixed-number ] }
{ 2 [ [ >bin ] "0b" pprint-prefixed-number ] }
[ drop number>string text ]
} case ;
@ -81,7 +81,7 @@ M: float pprint*
\ NAN: [ fp-nan-payload >hex text ] pprint-prefix
] [
number-base get {
{ 16 [ "0x" [ >hex ] pprint-prefixed-number ] }
{ 16 [ [ >hex ] "0x" pprint-prefixed-number ] }
[ drop number>string text ]
} case
] if ;