Note that (#~/@:|:) is a much faster inverse.

Marshall

On Mon, Jun 29, 2015 at 04:22:08PM +0000, 'Pascal Jasmin' via Programming wrote:
> pretty much the same as the rosettacode solution, but focused on an internal 
> representation rather than outputting a string
> 
> torle =: (1 ,~ 2&(~:/\)) ({. , #);.2 ]
> frle =: ([: ; <@#~/"1) :.torle
> 
> 
> 
> ----- Original Message -----
> From: Raul Miller <[email protected]>
> To: Programming forum <[email protected]>
> Cc: 
> Sent: Monday, June 29, 2015 12:04 PM
> Subject: Re: [Jprogramming] integer run length compression
> 
> Perhaps http://rosettacode.org/wiki/Run-length_encoding#J
> 
> Thanks,
> 
> -- 
> Raul
> 
> 
> On Mon, Jun 29, 2015 at 11:55 AM, John Baker <[email protected]> wrote:
> > I vaguely remember reading forum traffic sometime ago about a simple
> > J based run length encoding verb for integers.
> >
> > eg:
> >
> > If you have list of integers with many runs of the same value.
> >
> > 0 0 0 0 0 0 2 4 4 4 4 2 0 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 0 2
> > 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> >
> > What's a good way to compress, and decompress, this using only J?
> >
> > Just thought I would ask before rolling my own.
> >
> > --
> > John D. Baker
> > [email protected]
> > ----------------------------------------------------------------------
> > 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