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 lines:

   fmt=: cprintf 'v1: %d\nv2: %s\nv3: %d'
   fmt printf b;(flatten a);b
   fmt printf 3;(flatten b);4

I hope this helps,

-- 
Raul

On Mon, Aug 23, 2021 at 10:24 AM 'Rudolf Sykora' via Programming
<[email protected]> wrote:
>
>
> Raul Miller <[email protected]> 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?
>
>
> Ruda
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to