See http://www.jsoftware.com/jwiki/RE%20Boss/J-blog/MultipleBoxing for
correct output.


R.E. Boss


-----Oorspronkelijk bericht-----
Van: [email protected]
[mailto:[email protected]] Namens Roger Hui
Verzonden: donderdag 24 november 2011 21:45
Aan: Programming forum
Onderwerp: Re: [Jprogramming] multiple boxing (R.E. Boss)

This does not do what Boss specified.  (e.g. the singleton 2 in the example
is treated differently.)  The problem probably requires a recursive
function.



On Thu, Nov 24, 2011 at 12:25 PM, Shannon Ian <
[email protected]> wrote:

>
> foo =: (~: 1&|.) <^:{.;.2 ]
>
>
> This is a fork
> left verb is a hook defining the end of each sequence,
> middle verb  <^:{.;.2  cuts each sequence and applies boxing multiple
> number of times, where the number of times is the first number in the
> sequence.
>
> Ian
>
>
>
>
>
>
> Message: 3
> Date: Thu, 24 Nov 2011 15:27:19 +0100
> From: "R.E. Boss" <[email protected]>
> Subject: [Jprogramming] multiple boxing
> To: "Programming forum" <[email protected]>
> Message-ID: <[email protected]>
> Content-Type: text/plain;       charset="us-ascii"
>
> Given an array of positive integers A starting with 1 and such that  2 >
> >./
> 2 -~/\ A
>
>  (a next atom in A is at most 1 larger than the preceding one).
>
>
>
> Now I want the items to be boxed according to this example
>
>
>
>    foo  1 1 2 2 3 3 4 2 3 4 4 1 2 2 2 1
>
> +---+---------------------------+-+-------+-+
>
> |1 1|+---+---------+-+---------+|1|+-----+|1|
>
> |   ||2 2|+---+---+|2|+-+-----+|| ||2 2 2|| |
>
> |   ||   ||3 3|+-+|| ||3|+---+||| |+-----+| |
>
> |   ||   ||   ||4||| || ||4 4|||| |       | |
>
> |   ||   ||   |+-+|| || |+---+||| |       | |
>
> |   ||   |+---+---+| |+-+-----+|| |       | |
>
> |   |+---+---------+-+---------+| |       | |
>
> +---+---------------------------+-+-------+-+
>
>
>
>
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--------------
> This email is intended for the addressee(s) named and may contain
> confidential and/or privileged information.
> If you are not the intended recipient, please notify the sender and then
> delete it immediately.
> Any views expressed in this email are those of the individual sender
> except where the sender expressly and with authority states them to be the
> views of the Office of Environment and Heritage, NSW Department of Premier
> and Cabinet.
>
> PLEASE CONSIDER THE ENVIRONMENT BEFORE PRINTING THIS EMAIL
>
> ----------------------------------------------------------------------
> 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