I'm looking to indent a message based on a number of spaces (or tabs)
for use within a recursive function. I seem to remember this being
discussed before at some length but googling failed to enlighten me.
The horror I came up with looks like:
(format t (format nil "~~%~~~AT~~A" spaces)) message)
But I'm sure there's a better way.
Can anyone help?
Cheers
Charlieb.
charlieb <··@privacy.net> writes:
>
> I'm looking to indent a message based on a number of spaces (or tabs)
> for use within a recursive function. I seem to remember this being
> discussed before at some length but googling failed to enlighten me.
> The horror I came up with looks like:
>
> (format t (format nil "~~%~~~AT~~A" spaces)) message)
(format t "~vT~A" spaces message)
--
Thomas A. Russ, USC/Information Sciences Institute
Thomas A. Russ wrote:
> charlieb <··@privacy.net> writes:
>
>
>>I'm looking to indent a message based on a number of spaces (or tabs)
>>for use within a recursive function. I seem to remember this being
>>discussed before at some length but googling failed to enlighten me.
>>The horror I came up with looks like:
>>
>>(format t (format nil "~~%~~~AT~~A" spaces)) message)
>
>
> (format t "~vT~A" spaces message)
>
Thanks, now that I have an example that works I can figure out how it works!
Charlie.
charlieb wrote:
> I'm looking to indent a message based on a number of spaces (or tabs)
> for use within a recursive function.
I'm no format whiz, but here's mine, abbreviated to show just variable
indentation. Note that it indicates depth both with indentation and
explicitly:
(format stream "~&~v,,,'.<~d~>> " (mod *trcdepth* 100) *trcdepth*)
Wraps at trace depth 100, I guess because it came up once.
What I am doing is changing the field size, of the first field,
effectively indenting the whole shebang.
I think I started with ~t (tabulate (22.3.6.1 in your clhs)), then
decided the leading dots would help me align related calls.
kt
--
Home? http://tilton-technology.com
Cells? http://www.common-lisp.net/project/cells/
Cello? http://www.common-lisp.net/project/cello/
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
Your Project Here! http://alu.cliki.net/Industry%20Application
Kenny Tilton wrote:
>
>
> charlieb wrote:
>
>> I'm looking to indent a message based on a number of spaces (or tabs)
>> for use within a recursive function.
>
>
> I'm no format whiz, but here's mine, abbreviated to show just variable
> indentation. Note that it indicates depth both with indentation and
> explicitly:
>
> (format stream "~&~v,,,'.<~d~>> " (mod *trcdepth* 100) *trcdepth*)
>
> Wraps at trace depth 100, I guess because it came up once.
>
> What I am doing is changing the field size, of the first field,
> effectively indenting the whole shebang.
>
> I think I started with ~t (tabulate (22.3.6.1 in your clhs)), then
> decided the leading dots would help me align related calls.
>
> kt
>
Thanks, not quite what I had in mind but interesting to decypher
non-the-less.
Charlieb.
charlieb wrote:
> Kenny Tilton wrote:
>
>>
>>
>> charlieb wrote:
>>
>>> I'm looking to indent a message based on a number of spaces (or tabs)
>>> for use within a recursive function.
>>
>>
>>
>> I'm no format whiz, but here's mine, abbreviated to show just variable
>> indentation. Note that it indicates depth both with indentation and
>> explicitly:
>>
>> (format stream "~&~v,,,'.<~d~>> " (mod *trcdepth* 100) *trcdepth*)
>>
>> Wraps at trace depth 100, I guess because it came up once.
>>
>> What I am doing is changing the field size, of the first field,
>> effectively indenting the whole shebang.
>>
>> I think I started with ~t (tabulate (22.3.6.1 in your clhs)), then
>> decided the leading dots would help me align related calls.
>>
>> kt
>>
> Thanks, not quite what I had in mind but interesting to decypher
> non-the-less.
Well, I started with ~t tabulate and then found myself holding a
straightedge up to the screen so I could match expressions at the same
level (I had multiple statements tracking the same *trace-depth*
global). Then it occurred to me to make the first field one which got
its width from an argument, with a non-space fill character for the eye
to follow. pretty sure I started with "|", not sure why I switched to
".". Might have been too visually polluting.
kt
--
Home? http://tilton-technology.com
Cells? http://www.common-lisp.net/project/cells/
Cello? http://www.common-lisp.net/project/cello/
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
Your Project Here! http://alu.cliki.net/Industry%20Application
Kenny Tilton wrote:
>
> Well, I started with ~t tabulate and then found myself holding a
> straightedge up to the screen so I could match expressions at the same
> level (I had multiple statements tracking the same *trace-depth*
> global). Then it occurred to me to make the first field one which got
> its width from an argument, with a non-space fill character for the eye
> to follow. pretty sure I started with "|", not sure why I switched to
> ".". Might have been too visually polluting.
>
> kt
>
>
Mine's just a little task manager. Hopefully sub-task depth will be
small enough to keep it looking nice. If it isn't I'll be tearing my
hair out about the tasks long before the indentation makes a mark :)
Charlieb