An alternative for generating Chris' allhours using the foreign conjunction
8!:0

allhours=: , ('q<am>';'q<pm>') (8!:0"0 _) _1 |. >: i. 12


On Wed, Apr 2, 2014 at 11:59 PM, chris burke <cbu...@jsoftware.com> wrote:

> The argument i.24 to fmthours may be unnecessary.
>
>
> In any case, you can generate all hours as:
>
>
> allhours=: , (;:'am pm') (,~":) each/ _1|.1+i.12
>
>
> Then fmthours is:
>
>
> fmthours=: {&allhours
>
>
> For example;
>
>
>    fmthours 4
>
> +---+
>
> |4am|
>
> +---+
>
>    fmthours i.24
>
> +----+---+---+---+...
>
> |12am|1am|2am|3am|...
>
> +----+---+---+---+...
>
>
>
>
> On Wed, Apr 2, 2014 at 5:12 PM, glts <676c7...@gmail.com> wrote:
>
> >    fmthours i.24
> >
> >
> ┌────┬───┬───┬───┬───┬───┬───┬───┬───┬───┬────┬────┬────┬───┬───┬───┬───┬───┬───┬───┬───┬───┬────┬────┐
> >
> >
> │12am│1am│2am│3am│4am│5am│6am│7am│8am│9am│10am│11am│12pm│1pm│2pm│3pm│4pm│5pm│6pm│7pm│8pm│9pm│10pm│11pm│
> >
> >
> └────┴───┴───┴───┴───┴───┴───┴───┴───┴───┴────┴────┴────┴───┴───┴───┴───┴───┴───┴───┴───┴───┴────┴────┘
> >
> > Newbie here. With some effort I managed to squeeze the verb 'fmthours'
> > into a single line, but the result wasn't too pretty. The edge cases
> > (12am/pm) caused me the most trouble. How would a virtuos@ do it?
> >
> >
> > --
> > David
> > ----------------------------------------------------------------------
> > 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