[Jprogramming] Permutations
David Mitchell
davidmitchell at att.net
Thu Sep 29 18:24:23 HKT 2011
I find this helpful to see differences:
/:~ :/:@": &.>a,b
┌─ ~ ─── /:
┌─ : ─┴─ /:
┌─ @ ─┴─ ":
┌─ &. ─┴─ >
│
──┤ ┌─ a
└──────┼─ ,
└─ b
/:~:([:/:": )&.>a,b
┌─ /:
│ ┌─ ~:
│ │ ┌─ [:
──┤ │ ┌───┼─ /:
│ ├─ &. ─┤ └─ ":
└────┤ └─ >
│
│ ┌─ a
└──────┼─ ,
└─ b
--
David Mitchell
On 9/29/2011 5:45, Linda Alvord wrote:
> The only difference between the correct and the incorrect result is a space
> before the second : . Should a space make a difference ever? In the
> correct result I can't understand what it is, what it does and why it does
> it.
>
> /:~ :/:@":&.>a,b
> ------T-----┐
> │01123│01123│
> L-----+------
>
>
> /:~:([:/:": )&.>a,b
> 0 1
>
> Since I set out originally to remove "atop", how can I do it?
>
> /:~ :([: /: ":)&.>a,b
> ------T-----┐
> │10123│32110│
> L-----+------
>
> Hope you can help. Thanks. Linda
>
> -----Original Message-----
> From: programming-bounces at jsoftware.com
> [mailto:programming-bounces at jsoftware.com] On Behalf Of Ian Clark
> Sent: Thursday, September 22, 2011 9:13 PM
> To: Programming forum
> Subject: Re: [Jprogramming] Permutations
>
> Off-the-cuff...
>
> a=: 10123
> b=: 32110
> c=: 32100
> -:/ /:~ :/:@":&.> a,b
> 1
> -:/ /:~ :/:@":&.> a,c
> 0
>
>
> On Thu, Sep 22, 2011 at 10:41 PM, David Vaughan
> <purpleblues13 at googlemail.com> wrote:
>> Hi, what is the best (fastest) way to check whether a number is a
> permutation of another number?
>> I've tried listing all permutations of one number and checking whether the
> other number is in the list of permutations. This seems pretty slow, so I
> was hoping for a faster method.
>>
>> Thanks.
>> ----------------------------------------------------------------------
>> 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
More information about the Programming
mailing list