Hi Joey,

On Sat, 26 Apr 2008, Joey K Tuttle <[EMAIL PROTECTED]> writes:
> The count of t ( #t ) simply counted the number of bytes in the copy
> of the file.

Ok, got it.

> The next step in the wiki example puts each of the "lines" from the
> word list into a box - and the count of boxes (# word) is 173528. If
> you are asking how putting the list into boxes is accomplished ( word
> =. <;,_2 t ) then I think you really should try reading more in the j
> documentation about "Cut" ( ;. ) which can be found in the vocabulary
> section of the documentation, e.g.
>
>   http://www.jsoftware.com/help/dictionary/vocabul.htm
>
> Rather than deal with 173528 words, perhaps a 3 word example (excerpt
> from illustrated problem) would suffice.
>
>   ]words =. <;._2 'able deed deified writer '
> +----+----+-------+------+
> |able|deed|deified|writer|
> +----+----+-------+------+

I looked at Cuts documentation[1] but couldn't really understand what it
does. (Even checked the wiki, but no luck.) Would you mind giving some
more examples to illustrate the function of ;. operator? In the above
example you give, I just see that it splits a string into words. But I
don't think that's the actual function of ;. operator. BTW, what is a
box?

[1] http://www.jsoftware.com/help/dictionary/d331.htm

> The desire is to find words which are palindromes. Again, a read in
> the J documentation will show some nice tools for managing
> data. Reverse ( |. ) is one of them. e.g.
>
>   |. 'spacer'
> recaps
>
> One could apply reverse to the boxed list -
>
>    |. words
> +------+-------+----+----+
> |writer|deified|deed|able|
> +------+-------+----+----+
>
> but in this case, what is wanted is the reversal of each of the words
> (see entry for Dual ( &. ) in the vocabulary - i.e.
>
>    |. &.> words
> +----+----+-------+------+
> |elba|deed|deified|retirw|
> +----+----+-------+------+
>
> so if one makes a comparison of the words and their reversed form -
>
>    words = |. &.> words
> 0 1 1 0

Ok, I understand what |. and |.&. does. But I'd expect to |.&.words work
also. Expression raises "domain error". That suspicion is probably
because of lack of enough knowledge.

> We see that the first and last are not equal, while the middle two are
> palindromes. The next step simply reduces the list to only the ones of
> interest -
>
>    words #~ words = |. &.> words
> +----+-------+
> |deed|deified|
> +----+-------+

Ok, we set `words' to symmetric words in the string.

> I hope you can see the benefits of trying examples like this to learn
> more about J and how algorithms are expressed in it.

Thanks so much for your detailed answer. I hope I can grasp a little bit
of J to have a small idea about what some code I see does.


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

Reply via email to