I have to agree about ⎕FMT. I generally find it incomprehensible, and only mentioned it because that was the only reference to a flexible formatter that I could find (I didn't know about APL2 style format by example).
Perhaps I will write a formatter in pure APL at some point and make it available using the package manager. :-) Regards, Elias On 3 June 2014 18:43, Juergen Sauermann <[email protected]> wrote: > Hi Elias, > > I guess you need format characters 1, 2 and/or 3 for that: > > > '-12' ⍕ ¯42 42 > -42 42 > > Those cannot be combined with normal text. The decorators are not meant as > a shortcut for inserting > text into ⍕ but rather to improve formatting of signed numbers such as -42 > or (42) or 42 printed in red, > which used to be common in bookkeeping, instead of the rather uncommon ¯. > > You always get a fixed size output, so %d would not work as in printf(). > Same for the other dyadic ⍕ variant: > > 6 2⍕42 > 42.00 > > This is very much like %6.2d in C. > > Generally speaking, use monadic ⍕ for output of variable size and > dyadic ⍕ for columns of fixed size. > > I can't really see that ⎕FMT is adding much value, and we also have > FILE_IO with printf() > as an alternative. > > /// Jürgen > > > > On 06/03/2014 07:43 AM, Elias Mårtenson wrote: > > I'm trying to coerce ⍕ into doing something that should be trivial. Assume > I have a number N, and I want to display it like in a printf using the > pattern "value=%d". > > I've tried all sorts of variations, but I just can't make it happen. > It's all good until I try to pass in a negative value. How can I do this? > > Secondly, it seems to me as though this thing is designed with > preformatted columnar data in mind. This kind of formatting is increasingly > rare these days, so I still feel that a more powerful formatting facility > is needed. Something along the lines of the Common Lisp FORMAT function > would be nice. > > Regards, > Elias > > >
