I geuss this is a bug. On the other hand, /:~ on numeric, box or unicode 
scalars works.

this will crash.
/:~'A'

Сбт, 15 Окт 2011, Nick Simicich писал(а):
> In Euler 98, there is a need to see if words are permutations of each other.
>  I thought that rather than make permutation signatures, I would sort the
> words, because a sorted word should equal a sorted word when they are
> permutations, and, well, I can probably make permutation indexes allowing 4
> unsigned bits for characters, but that would require 104 bits for 26
> letters.  Even 3 bits requires 78 bits.  So 64 bit permutation indexes fail.
> 
> 
> So I tried to sort the words. Observe:
> 
>    ]S:_1]0{boxwords
> A
>     /:~L:_1 boxwords
> ┌─┬───────┬────┬─────┬─────┬───────┬──────────┬────────┬──────┬──────┬────────┬─────────┬─────────┬───────┬───────┬───────────┬────┬───────┬──────┬───┬──────┬──────┬────────┬──────┬────────┬───┬────────┬──────────┬───────┬──────────────┬─────┬─────┬─────┬─...
> │
> │ABIILTY│ABEL│ABOTU│ABEOV│ABCEENS│ABELLOSTUY│AACCDEIM│ACCEPT│ACCESS│ACCDEINT│AACCMNOPY│ACCDGINOR│ACCNOTU│ACEEHIV│ACEEEHIMNTV│ACDI│ACEIQRU│ACORSS│ACT│ACINOT│ACEITV│ACIITTVY│AACLTU│AACLLTUY│ADD│ADDIINOT│AADDIILNOT│ADDERSS│AADIIIMNNORSTT│ADIMT│ADOPT│ADLTU│A...
> └─┴───────┴────┴─────┴─────┴───────┴──────────┴────────┴──────┴──────┴────────┴─────────┴─────────┴───────┴───────┴───────────┴────┴───────┴──────┴───┴──────┴──────┴────────┴──────┴────────┴───┴────────┴──────────┴───────┴──────────────┴─────┴─────┴─────┴─...
>    0{boxwords
> ┌─┐
> │A│
> └─┘
>    /:~L:_1]0{boxwords
> ┌─┐
> │ │
> └─┘
> 
> This is the story.
> 
> The first element in the boxed list of words is the single letter word A.
> 
> When you try to sort it, it vanishes, but other letters do not.  This is a
> more visible example, limited to 5 words:
> 
> 
>    (i.5){boxwords
> ┌─┬───────┬────┬─────┬─────┐
> │A│ABILITY│ABLE│ABOUT│ABOVE│
> └─┴───────┴────┴─────┴─────┘
>    /:~L:_1(i.5){boxwords
> ┌─┬───────┬────┬─────┬─────┐
> │ │ABIILTY│ABEL│ABOTU│ABEOV│
> └─┴───────┴────┴─────┴─────┘
> 
> See?  Other lists are sorted properly.  This one list fails.
> 
>    /:~'a'
> 
> shows the same failure.
> 
> Now, I finally see this, which is even weirder.
> 
> /:~@,L:_1(i.5){boxwords
> ┌─┬───────┬────┬─────┬─────┐
> │A│ABIILTY│ABEL│ABOTU│ABEOV│
> └─┴───────┴────┴─────┴─────┘
> 
> Is it as simple as the 'A' is a scalar and that you can't sort a scalar, but
> raveling it turns it into a one element vector that can be sorted?
> -- 
> Of course I can ride in the carpool lane, officer.  Jesus is my constant
> companion.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to