Let's say I'm debugging a program step by step and want to Print some expressions (using ShowIt, for example).
Is there a way to output the result of Print on top of already printed expressions instead of at the bottom?
|
Let's say I'm debugging a program step by step and want to Is there a way to output the result of |
||||
|
|
|
This is admittedly messy, but something along these lines might work:
This function moves the insertion point just below the evaluation cell before inserting the text or expression to be printed. Let's test it:
Problems:
|
|||||||
|
|
This is an arguably even messier solution than Szabolcs', and its performance isn't going to win any awards, but it has some (somewhat dubious) advantages:
The function in question creates a dummy cell that will eventually contain the output as a side-effect, and returns a closure that you call like
First, You use it like so:
which will give output that looks like
|
||||
|