I use #. quite a bit, to convert strings of digits to integers:
Find all the three-digit integers that can be formed from the digits 2, 4,
& 6, with no duplication (permutations).
10#. 2 4 6 {~ (i.@! A.i.) 3
246 264 426 462 624 642
Woould this functionality stay the same?
Skip
Skip Cave
Cave Consulting LLC
On Wed, Jul 4, 2018 at 10:23 AM David Lambert <[email protected]> wrote:
> I agree with Joey Tuttle's idea. I can't think of any instances when
> I've wanted scalar x to be x|
>
> 8 (| -: #:)j./~i:20
> 1
>
>
> Furthermore j's antibase returns 1 quarter, a half dime, a nickel, and 3
> pennies when asked to make change for 38 cents. My version gives 1
> quarter, 1 dime, and 3 pennies. Last time I brought this up I met with
> general agreement that j's implementation is best, I still disagree.
>
> antibase =: [: :(|.@:}.@:((((| , <.@:%~) {.@:]) , }.@:])/)@:((,~ (1 ,
> |.@:(*/\.)@:}.))~)"1 0)
> assert 1 1 0 3 -: 2 5r2 2 5 antibase 38 NB. change for 38 cents
>
>
> 2 5r2 2 5 #: 38
> 1 1r2 1 3
>
>
> On 07/04/2018 08:00 AM, [email protected] wrote:
> > Date: Tue, 3 Jul 2018 20:31:18 -0700
> > From: Joey K Tuttle<[email protected]>
> > To:[email protected]
> > Subject: [Jprogramming] A possible change to behavior of #:
> > Message-ID:<[email protected]>
> > Content-Type: text/plain; charset=us-ascii
> >
> > Can anyone provide a reason it would be undesirable to have a scalar
> left (x) argument to #: behave any differently than x (#.^:_1) y ?
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm