Here is one way:

    d=: 13 : '/:~ :/:@": &.>y'
    e=: 13 : '/:~:/:@": &.>y'
    5!:4 <'d'
                    ┌─ ~ ─── /:
              ┌─ : ─┴─ /:
        ┌─ @ ─┴─ ":
── &. ─┴─ >
    5!:4 <'e'
   ┌─ [:
   ├─ /:
──┤    ┌─ [:
   │    ├─ ~:
   └────┤            ┌─ /:
        │      ┌─ @ ─┴─ ":
        └─ &. ─┴─ >

--
David Mitchell

On 10/1/2011 3:27, Linda Alvord wrote:
> I knew how to get tree diagrams in earlier versions of J, but wonder how to
> get them in J701jhs.
>
> Linda
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of David Mitchell
> Sent: Thursday, September 29, 2011 6:24 AM
> To: Programming forum
> Subject: Re: [Jprogramming] Permutations
>
> I find this helpful to see differences:
>
>      /:~ :/:@":&.>a,b
>                        -- ~ --- /:
>                  -- : -+- /:
>            -- @ -+- ":
>     --&. -+->
>     │
> --+      -- a
>     L------+- ,
>            L- b
>
>
>      /:~:([:/:": )&.>a,b
>     -- /:
>     │    -- ~:
>     │    │          -- [:
> --+    │      ----+- /:
>     │    +-&. -+   L- ":
>     L----+      L->
>          │
>          │      -- a
>          L------+- ,
>                 L- 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: [email protected]
>> [mailto:[email protected]] 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
>> <[email protected]>   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
> ----------------------------------------------------------------------
> 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