The prettyprinter supports multi-line output, and is used to implement things like ``see``.
It looks like the line-breaks aren't used that much and work, but not in the way you expect. This is a workaround for you: TUPLE: newline < block ; M: newline section-fits? drop f ; : <newline ( -- ) newline new-block (<block) ; M: cell pprint* drop <newline "01_" text block> <newline "5_2" text block> <newline "_43" text block> ; I'll try and fix the prettyprinter to handle line-breaks in a more normal manner. On Fri, Apr 1, 2016 at 2:33 PM, Alexander Ilin <ajs...@yandex.ru> wrote: > Hello! > > I'm trying to visualize some simple data structures, and I thought > prettyprinting should fit my bill. > > Here's the thing I'm trying to show: > > USING: bit-sets ; > IN: scratchpad > TUPLE: cell { underlying bit-set } ; > > The idea is that a cell contains a set of 6 bits 0..5, each representing > a position on a circular dial. > I want it to be displayed in a clockwise fashion on three lines like > this: > > 01_ > 5_2 > _43 > > Underscore (put in here for alignment purposes) represents a single > whitespace character. Any number that is not currently "in?" the > "underlying" bit-set should be displayed as missing (or with an underscore). > For example: > > 6 <bit-set> dup 0 swap adjoin dup 3 swap adjoin dup 5 swap adjoin cell boa > . > > Should result in: > > 0__ > 5__ > __3 > > So far I've got this: > > M: cell pprint* drop <block > "01_" text hard add-line-break > "5_2" text hard add-line-break > "_43" text hard add-line-break block> ; > > Despite my attempt to add hard line breaks, the cell tuple is displayed > one line in data stack and when using the . word: > > --- Data stack: > 01_ 5_2 _43 > > Is there a way to do 2-dimensional output with prettyprinter, or should > I use a completely different approach? > > ---=====--- > Александр > > > ------------------------------------------------------------------------------ > Transform Data into Opportunity. > Accelerate data analysis in your applications with > Intel Data Analytics Acceleration Library. > Click to learn more. > http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140 > _______________________________________________ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk >
------------------------------------------------------------------------------
_______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk