I wrote:

>  The limitation is that your number of copies can't be a positive power of

>  10.

 

I'm still playing with an extended constant notation.  Specifically, I would 
like a notation like:

 

     <decimal digits> <delimiter> <decimal digits> <delimiter> <decimal digits>

 

To faithfully and unambiguously pack 3 independent integer values into a single 
scalar value, using J's current constant notation
(taking into account practical limitations, including precision).  

 

My earlier attempts used e and j as delimiters; I've recanted on the e and 
decided . is a more faithful delimiter.  This
simultaneously avoids the problems of 0 copies and powers-of-ten fills:

 

        decompose =: (<.@:({:"1) ,.~ [: ({."1 ,. 2&}.&.":@:{:"1) _ 1 #: 
{."1)@:+.

        decompose  1.2j3 10.2j3 0.1j2 3j2 0j5 7 0

      1 2 3

     10 2 3

      0 1 2

      3 0 2

      0 0 5

      7 0 0

      0 0 0

             

Now I'm looking for:

 

     a.  Other ideas for the delimiters.

     b.  Considerations for my currently selected 

    delimiters.

     c.  Test cases for any given delimiters, but 

    specifically for the delimiters . and j

     d.  Faster versions of decompose.

     e.  More elegant versions of decompose 

    (specifically avoiding the need to format 

    and evaluate strings).

 

The latter two may be at odds, so independent verbs are fine.  Then maybe we 
can mix and match.

 

-Dan

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to