Re: Yapp (yet another pretty print)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hello Pete, you wrote:

> On Thu, 22 May 2003 18:30:36 +0200, Juergen Luethje <j.lue at gmx.de>
> wrote:
>
> <snip>
>> How about putting a space after each comma, except in the innermost leve=
l
>> of a sequence? smile
>
> Sure, just put this around line 163(ish):
>
> if atom(cl[i]) and (i=3Dlength(cl) or atom(cl[i+1])) then
> 	sep=3D","
> else
> 			sep=3D", "
> end if
>
> Pete

Thank you, that works fine!

I think I've found a bug. It was alredy there, before I applied the
modification mentioned above. Please try:

-------=3D-------------------------=3D-------
include yapp.e
sequence s

s =3D {{{"blue", "red"}, {"cyan", "white"}},
     {{"blue", "red"}, {"cyan", "white"}}}

prnt(s, 2)
puts(1, "---------------------------\n")
prnt(s, 3)
-------=3D-------------------------=3D-------

Unfortunately, I don't have sufficient understanding of the algorithm,
to tweak it myself.


                 ~~~=B0~~~=B0~~~=B0~~~=B0~~~


Another suggestion. The current version doesn't print special characters
above ASCII 126. The German language has the "umlauts"
(196,214,220,228,246,252) and the "sz" (223, looking like the Greek
"beta"). There are also special characters in other languages, such as
Spanish, French, Danish, Czech, etc.

Therefore, in function prnf() I removed
    or cl[i]>'~'
    and cl<=3D'~'

I believe this is not critical, because AFAIK the characters above ASCII
126 are no control characters, which might change the output in an
unwanted way (e.g. like Carriage Return).
The only disadvantage I'm aware of, is that this increases the chance,
that a sequence, that is meant as "array" of numbers, unintentionally is
printed as a string.

On the other hand, without this change, not all strings are printed as
strings, and (at least in the German language) there are *quite many*
words containing those special characters. So if you don't like my
"radical" blink solution, IMHO at least there should be an option for the
procedure prntEx(), to achieve this behaviour (like the appropriate
option in pretty_print() by RDS).

Thanks again for these pretty procedures.

Best regards,
   Juergen

--=20
 /"\  ASCII ribbon campain  |
 \ /  against HTML in       |  This message has been ROT-13 encrypted
  X   e-mail and news,      |  twice for higher security.
 / \  and unneeded MIME     |

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu