All: Even more specifically, I'd like to format n as a two-digit,
zero-padded, hexadecimal number.

8!:0 = fail for this.

Cheers,

Andrew Pennebaker
www.yellosoft.us



On Tue, Nov 1, 2011 at 10:02 PM, Raul Miller <[email protected]> wrote:

> I do not like that because it's a space replacer -- it's not designed
> for leading zeros.
>
> Consider:
>
>   'r<0>3.0' (8!:0) -5
>
> Mind you, my approach would need some extension also, when dealing
> with negative numbers, but this is mostly a philosophical issue.
>
> --
> Raul
>
> On Tue, Nov 1, 2011 at 9:51 PM, Ric Sherlock <[email protected]> wrote:
> > I would've turned to:
> >   'r<0>2.0' (8!:0) 5
> > ┌──┐
> > │05│
> > └──┘
> >
> >
> > On Wed, Nov 2, 2011 at 2:35 PM, Raul Miller <[email protected]>
> wrote:
> >> Personally, I'd probably use }.":100+5 for that
> >>
> >> --
> >> Raul
> >>
> >> On Tue, Nov 1, 2011 at 7:34 PM, Andrew Pennebaker
> >> <[email protected]> wrote:
> >>> I'd like to make a distinction between width and precision. From what I
> >>> gather in the interpreter, %2.2d prints "5.00", but what I want is
> "05".
> >>> That's what happens with fmt, anyway.
> >>>
> >>> Cheers,
> >>>
> >>> Andrew Pennebaker
> >>> www.yellosoft.us
> >>>
> >>> On Tue, Nov 1, 2011 at 5:27 PM, Henry Rich <[email protected]>
> wrote:
> >>>
> >>>> I'll try to fix that long-standing deficiency when I port to 7.01.  In
> >>>> the meantime, use %2.2d (it does support width, just not the 0 flag).
> >>>>
> >>>> Henry Rich
> >>>>
> >>>> On 11/1/2011 5:20 PM, Andrew Pennebaker wrote:
> >>>> > I'd also like to see width specifiers in printf/sprintf, a la C.
> That
> >>>> would
> >>>> > let printf do "%02d", i.e. zero-pad an integer until it fills two
> >>>> > characters. I know it's not critical, but I'd like to see a more
> complete
> >>>> > interface for these functions.
> >>>> >
> >>>> > Cheers,
> >>>> >
> >>>> > Andrew Pennebaker
> >>>> > www.yellosoft.us
> >>>> >
> >>>> > On Tue, Nov 1, 2011 at 1:56 PM, David Mitchell<
> [email protected]
> >>>> >wrote:
> >>>> >
> >>>> >> You would have to put printf.ijs there yourself.  As you found, it
> is
> >>>> not
> >>>> >> installed there in J7.
> >>>> >>
> >>>> >> I would suggest temporarily copying it yourself from the J6
> directory
> >>>> to a
> >>>> >> J7
> >>>> >> directory, perhaps your J7 user directory.
> >>>> >>
> >>>> >> As I recall the beta test and release schedule of J7, the reasons
> for
> >>>> the
> >>>> >> release of a 'unfinished' J7 were several:
> >>>> >>
> >>>> >> 1) The support philosophy of J7 was radically different than prior
> J
> >>>> >> versions,
> >>>> >> in my opinion.  J7 is now essentially open source and depends on
> user
> >>>> >> contributions for future enhancements and even conversions of some
> of
> >>>> the
> >>>> >> previously 'standard' scripts.
> >>>> >>
> >>>> >> 2) The file structure of J7 was significantly different than J6.
>  As far
> >>>> >> as I
> >>>> >> can see, the goal was to simplify the 'core' J as much as possible
> and
> >>>> >> move as
> >>>> >> many 'non-core' scripts as possible to the addons directories.
> >>>> >>
> >>>> >> 3) The elimination of the long time favorite 'wd' interface in J7
> meant
> >>>> >> that
> >>>> >> many support scripts would have to be radically rewritten to work
> with
> >>>> J7.
> >>>> >> While printf does not use 'wd', printf may have gotten caught up
> in the
> >>>> >> general
> >>>> >> direction of J7 and left as an exercise for the user.
> >>>> >>
> >>>> >> See more discussion about this topic in the historical logs of the
> Beta
> >>>> >> Forum.
> >>>> >>
> >>>> >> Cheers,
> >>>> >> --
> >>>> >> David Mitchell
> >>>> >>
> >>>> >>
> >>>> >> On 11/1/2011 13:23, Andrew Pennebaker wrote:
> >>>> >>> I ls'd the j64-701/system/main/ directory and found no printf.ijs
> file.
> >>>> >>>
> >>>> >>> Why would JSoftware release a new v7 version of J without first
> >>>> upgrading
> >>>> >>> the addons from v6?
> >>>> >>>
> >>>> >>> Cheers,
> >>>> >>>
> >>>> >>> Andrew Pennebaker
> >>>> >>> www.yellosoft.us
> >>>> >>>
> >>>> >>> On Tue, Nov 1, 2011 at 6:54 AM, David Mitchell<
> [email protected]
> >>>> >>> wrote:
> >>>> >>>
> >>>> >>>> Andrew,
> >>>> >>>>
> >>>> >>>> I don't have access to J on a Mac, so I cannot guarantee that the
> >>>> >> process
> >>>> >>>> that
> >>>> >>>> worked for me will work for you.  But, I suspect that it will.
> >>>> >>>>
> >>>> >>>> What I recommend is that you install both J6.02 and J7.01 on
> your Mac.
> >>>> >>>>    There
> >>>> >>>> are elements of J6.02 that are not currently included in J7.01.
> >>>> >>>>
> >>>> >>>> Some of the elements that are not included in J7.01 from J6.02
> are
> >>>> >> mostly
> >>>> >>>> or
> >>>> >>>> wholly compatible with J7.01, but these elements have currently
> not
> >>>> been
> >>>> >>>> migrated to J7.01.
> >>>> >>>>
> >>>> >>>> The printf script is one of those J6.02 elements that does not
> appear
> >>>> to
> >>>> >>>> have
> >>>> >>>> been migrated to J7.01.
> >>>> >>>>
> >>>> >>>> I have both J6.02 and J7.01 installed on Windows 7_64. After I
> saw
> >>>> your
> >>>> >>>> question
> >>>> >>>> concerning printf, I looked in J6.02 using "Find in Files" and
> found
> >>>> >> that
> >>>> >>>> the
> >>>> >>>> printf verbs were defined in j602/system/main/printf.ijs.
> >>>> >>>>
> >>>> >>>> I looked at the definitions of the printf verbs to see if I
> could see
> >>>> >> any
> >>>> >>>> reason
> >>>> >>>> why they would not work on J7.01 or on a Mac.  I did not see any
> >>>> obvious
> >>>> >>>> reason
> >>>> >>>> that they were likely to fail on J7.01 or a Mac.  I also noticed
> that
> >>>> >> the
> >>>> >>>> printf.ijs script had a built-in test that validated many of the
> verbs
> >>>> >> and
> >>>> >>>> formats supported by printf.ijs.  I ran the test on J7.01 and
> the test
> >>>> >>>> reported
> >>>> >>>> that all of the tests ran fine.
> >>>> >>>>
> >>>> >>>> Based on that result and my own casual testing of printf verbs, I
> >>>> >> believe
> >>>> >>>> that,
> >>>> >>>> if you install J6.02, you will likely be able to load printf.ijs
> from
> >>>> >> J6.02
> >>>> >>>> while running J7.01 on your Mac and that will define the printf
> verbs
> >>>> >> and
> >>>> >>>> provide you the printf functionality.
> >>>> >>>>
> >>>> >>>> At some point, some one may decide that the J6.02 printf.ijs
> script
> >>>> >> should
> >>>> >>>> be
> >>>> >>>> included in J7.01.  Because of the decision to move many of the
> J6.02
> >>>> >>>> included
> >>>> >>>> .ijs scripts from the main J system directories to the addons
> >>>> >> directories,
> >>>> >>>> it
> >>>> >>>> will probably wind up in addons/format or addons/general/misc
> >>>> directory.
> >>>> >>>>
> >>>> >>>> I must admit I had not bumped into Mitchell and Webb before.
>  One of
> >>>> >> these
> >>>> >>>> days,
> >>>> >>>> I should start a web site (if it doesn't already exist) where
> all of
> >>>> us
> >>>> >>>> David
> >>>> >>>> Mitchell's could gather.  Until the advent of the web, I had
> thought
> >>>> >> that
> >>>> >>>> I had
> >>>> >>>> a reasonably unique name.  Since the web, I have discovered that
> there
> >>>> >> are
> >>>> >>>> hundreds, if not thousands of David Mitchell's just in NY State.
> >>>> >>>>
> >>>> >>>> All the best,
> >>>> >>>> --
> >>>> >>>> David Mitchell
> >>>> >>>>
> >>>> >>>>
> >>>> >>>> On 10/31/2011 14:02, Andrew Pennebaker wrote:
> >>>> >>>>> David: Are you saying that J701 x64 for Mac currently supports
> printf
> >>>> >> by
> >>>> >>>>> default, or that printf must be compiled, or something else?
> >>>> >>>>>
> >>>> >>>>> What's your opinion of Mitchell and Webb?
> >>>> >>>>>
> >>>> >>>>> Cheers,
> >>>> >>>>>
> >>>> >>>>> Andrew Pennebaker
> >>>> >>>>> www.yellosoft.us
> >>>> >>>>>
> >>>> >>>>> On Mon, Oct 31, 2011 at 7:02 AM, David Mitchell<
> >>>> [email protected]
> >>>> >>>>> wrote:
> >>>> >>>>>
> >>>> >>>>>> The J6 version of printf (system/main/printf.ijs) seems to
> work fine
> >>>> >>>> with
> >>>> >>>>>> J7.
> >>>> >>>>>>
> >>>> >>>>>> I enabled the built-in test cases and ran the printf tests on
> J7_64
> >>>> >> and
> >>>> >>>>>> there
> >>>> >>>>>> were no errors reported.
> >>>> >>>>>>
> >>>> >>>>>> NB. modify script to run tests.
> >>>> >>>>>> NB. Test lines (change ^:0 to ^:1 to run test)
> >>>> >>>>>>      load 'c:/users/me/j602/system/main/printf.ijs'
> >>>> >>>>>> Error count: 0
> >>>> >>>>>>
> >>>> >>>>>> All the best,
> >>>> >>>>>> --
> >>>> >>>>>> David Mitchell
> >>>> >>>>>>
> >>>> >>>>>> On 10/31/2011 1:32, Andrew Pennebaker wrote:
> >>>> >>>>>>> $ jconsole
> >>>> >>>>>>>        load 'printf'
> >>>> >>>>>>> not found: /Users/andrew/Desktop/printf
> >>>> >>>>>>> |file name error: script
> >>>> >>>>>>> |       0!:0 y[4!:55<'y'
> >>>> >>>>>>>
> >>>> >>>>>>> Specs:
> >>>> >>>>>>>
> >>>> >>>>>>>        - J701 x64
> >>>> >>>>>>>        - Mac OS X Lion 10.7.2
> >>>> >>>>>>>
> >>>> >>>>>>> Cheers,
> >>>> >>>>>>>
> >>>> >>>>>>> Andrew Pennebaker
> >>>> >>>>>>> www.yellosoft.us
> >>>> >>>>>>>
> >>>> >>
> ----------------------------------------------------------------------
> >>>> >>>>>>> For information about J forums see
> >>>> >> http://www.jsoftware.com/forums.htm
> >>>> >>>>>>>
> >>>> >>>>>>
> >>>> ----------------------------------------------------------------------
> >>>> >>>>>> For information about J forums see
> >>>> >> http://www.jsoftware.com/forums.htm
> >>>> >>>>>>
> >>>> >>>>>
> >>>> ----------------------------------------------------------------------
> >>>> >>>>> For information about J forums see
> >>>> http://www.jsoftware.com/forums.htm
> >>>> >>>>>
> >>>> >>>>
> ----------------------------------------------------------------------
> >>>> >>>> For information about J forums see
> >>>> http://www.jsoftware.com/forums.htm
> >>>> >>>>
> >>>> >>>
> ----------------------------------------------------------------------
> >>>> >>> For information about J forums see
> http://www.jsoftware.com/forums.htm
> >>>> >>>
> >>>> >>
> ----------------------------------------------------------------------
> >>>> >> For information about J forums see
> http://www.jsoftware.com/forums.htm
> >>>> >>
> >>>> >
> ----------------------------------------------------------------------
> >>>> > For information about J forums see
> http://www.jsoftware.com/forums.htm
> >>>> >
> >>>> ----------------------------------------------------------------------
> >>>> For information about J forums see
> http://www.jsoftware.com/forums.htm
> >>>>
> >>> ----------------------------------------------------------------------
> >>> For information about J forums see http://www.jsoftware.com/forums.htm
> >>>
> >> ----------------------------------------------------------------------
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> 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