I was just practicing "going backwards" this morning and look what I got!

    f=: (A=:$ -. 1:) ($,) ]
    g=: 13 :'(($y)-. 1:y)$,y '
    
   f
($ -. 1:) ($ ,) ]
   g
, $~ $ -. 1:

Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Brian Schott
Sent: Tuesday, March 04, 2014 5:00 PM
To: Programming forum
Subject: Re: [Jprogramming] Remove 1s from shapes

That's funny. I almost said what you did. Thanks.


On Tue, Mar 4, 2014 at 4:44 PM, Roger Hui <[email protected]> wrote:

>    f=: ($ -. 1:) ($,) ]
>    $ f 3 1 4 1 5 9 $ 'abc'
> 3 4 5 9
>
>
>
> On Tue, Mar 4, 2014 at 1:38 PM, Brian Schott <[email protected]>
> wrote:
>
> > Is there a general verb that can reshape any noun with 1s in its shape
so
> > that the axes with 1s disappear? I know that most often changing
> > calculations slightly can eliminate the 1s before they arise, but not
> > always.
> >
> > For example if $a == 4 1 4 3, is there a verb that will
> > make generalize the result like how ,"_2]1|: does in this case?
> > $,"_2]1|:a   ==  4 4 3
> >
> > --
> > (B=)
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
(B=) <-----my sig
Brian Schott
----------------------------------------------------------------------
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