So, ok, here's the definition we're talking about:

   words=: [: ;: ' '"_`(I.@:= toupper)`]}~@tolower

This is basically a sequence of three operations, which are performed
from right to left
   ;: gerund}~ tolower

I think you are familiar with ;: and tolower so let's take a look at
the gerund}~ part of the phrase. Here's a short example:

   ' '"_`(I.@:= toupper)`]}~ 'this, is a test.'
this  is a test

Here's an expanded and rephrased version of that phrase:
   lower=. 'this, is a test.'
   upper=. toupper lower
   mask=. lower = upper
   indices=. I.mask
   ' ' indices} lower
this  is a test

In other words, any character which toupper leaves alone gets replaced
with a space.

Here's how each of the verbs in that gerund work for this example:

   ' '"_~ 'this, is a test.'

   (I.@:= toupper)~ 'this, is a test.'
4 5 8 10 15
   ]~ 'this, is a test.'
this, is a test.

Note that I need the ~ to get the behavior from gerund} that I want.
None of these verbs need ~ when used by themselves, but in context
they do need that.

I hope this is clear enough?

Thanks,

-- 
Raul


On Wed, Jan 27, 2016 at 9:30 AM, Brian Schott <[email protected]> wrote:
> Raul,
>
> I have been trying to understand your verb  word using the following
> sentence from your post.
>
>    words'Though of course, it''s possible to format that result
> differently.'
> +------+--+------+--+-+--------+--+------+----+------+-----------+
> |though|of|course|it|s|possible|to|format|that|result|differently|
> +------+--+------+--+-+--------+--+------+----+------+-----------+
>
> As you see above, it seems to work, but I cannot understand it. At one
> point I thought only ;: and tolower  alone would be enough but even got
>  the error  below.
>
>    ;:'Though of course, it''s possible to format that result differently.'
> |open quote
> |   Though of course, it's possible to format that result differently.
> |                       ^
> |       ;:'Though of course, it''s possible to format that result
> differently.'
>
>
>
> On Wed, Jan 27, 2016 at 7:33 AM, Henry Rich <[email protected]> wrote:
>
>> That's clever.
>>
>> Henry Rich
>>
>> On 1/27/2016 12:15 AM, Raul Miller wrote:
>>
>>> I guess I'd be inclined to do it like this:
>>>
>>> require'web/gethttp'
>>> const=: gethttp 'http://usconstitution.net/const.txt'
>>> words=: [: ;: ' '"_`(I.@:= toupper)`]}~@tolower
>>>
>>>     \:~ (<@#/.~,.~.)words const
>>> +---+-----+
>>> |727|the  |
>>> +---+-----+
>>> |495|of   |
>>> +---+-----+
>>> |306|shall|
>>> +---+-----+
>>> |264|and  |
>>> +---+-----+
>>> |202|to   |
>>> ...
>>>
>>> Though of course, it's possible to format that result differently.
>>>
>>> Thanks,
>>>
>>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>
> --
> (B=)
> ----------------------------------------------------------------------
> 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