Re: [Jprogramming] printf and newlines

2021-08-24 Thread rsykora via Programming
August 23, 2021 5:08 PM, "Raul Miller" wrote: > You might try > require'general/misc/format format/printf' > a=:i.2 2 [ b=:6 > 'v1: %d\nv2: %s\nv3: %d\n' printf b;(flatten a);b Thanks, I did not know 'flatten' before. Ruda -- F

Re: [Jprogramming] printf and newlines

2021-08-23 Thread Raul Miller
You might try require'general/misc/format format/printf' a=:i.2 2 [ b=:6 'v1: %d\nv2: %s\nv3: %d\n' printf b;(flatten a);b Note also that if you are re-using a format string many times, you can save some overhead by "pre-compiling" the format string and reusing that result, along these li

Re: [Jprogramming] printf and newlines

2021-08-23 Thread 'Rudolf Sykora' via Programming
Raul Miller writes: > The problem here is that you told printf that you were giving it a > list of characters but did not do so. Thanks. Is then this the right way to print such a combination: b=: 6 a=: i. 2 2 '%d%s%d' printf b; (,((":a),"1 LF)) ; b or can the middle part be made simpler?

Re: [Jprogramming] printf and newlines

2021-08-23 Thread Raul Miller
The problem here is that you told printf that you were giving it a list of characters but did not do so. printf printf_jprintf_ printf_jprintf_ display@sprintf a=:1+i.2 2 b=:6 'x%dx%sx%dx' sprintf b; (":a) ; b x 6 x 1 2 3 4 x 6 x $'x%dx%sx%dx' sprintf b; (":a) ; b 9 3 <"1 'x%d

[Jprogramming] printf and newlines

2021-08-23 Thread 'Rudolf Sykora' via Programming
Dear list, I have been surprised by this: --- ]a=: _2 ]\ 1 2 3 4 1 2 3 4 b=: 6 'x%d%d' printf b; b x66 'x%d%s%d' printf b; (":a) ; b x 6 1 2 3 4 6 --- I do not understand who adds the newlines in the last case. I'd expect something like x61 2 3 46 especially when 'x%d%s%d' pri