prettyprint: fix .b, .o, and .h for negative numbers.

Also makes these useful for nested printing in different number bases.
modern-harvey2
John Benediktsson 2017-06-11 10:57:01 -07:00
parent 634df46db9
commit bf6300b7b0
1 changed files with 3 additions and 3 deletions

View File

@ -38,9 +38,9 @@ IN: prettyprint
: error-in-pprint ( obj -- str )
class-of name>> "~pprint error: " "~" surround ;
: .b ( n -- ) >bin "0b" prepend print ;
: .o ( n -- ) >oct "0o" prepend print ;
: .h ( n -- ) >hex "0x" prepend print ;
: .b ( n -- ) 2 number-base [ . ] with-variable ;
: .o ( n -- ) 8 number-base [ . ] with-variable ;
: .h ( n -- ) 16 number-base [ . ] with-variable ;
: stack. ( seq -- )
[