Roger Hui <[EMAIL PROTECTED]> wrote:
>    (<')') = <,')'
> 0
>    (<,')') = ;: '=. ( ()=. )'
> 0 0 0 1 0 1

"p j" <[EMAIL PROTECTED]> wrote:
>    (<')') = ;: '=. ( ()=. )'
> 0 0 0 0 0 0
>
>     >#each  ;: '=. ( ()=. )'
> 2 1 1 1 2 1
>
> I would expect 2 matches (1s) from the first line.

You are missing one subtle, but fundamental property of
J character constants.
Constants of length 1 are atoms (0 dimensional),
while other lengths produce lists (1 dimensional).
;: and gerunds always use lists, even for length-1 strings.

<')' is a boxed atom, while <.')' is a boxed length-1 string.
#each will return 1 for each, since # returns 1 for atoms.
However, if you tried $each you would see that the
shapes are NOT the same: $')' is an empty list, while $,')'
is ,1 (which itself looks the same, but is different from 1)

Just because things look the same, doesn't mean they are.
A more glaringly obvious example of this:
   a =: 3
   b =: '3'
   a
3
   b
3
   a=b
0

-- Mark D. Niemiec <[EMAIL PROTECTED]>

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to