Thank you for the beautiful jems.

My initial motivation was more like self-satisfying. And I think the
friends in the local community would think so, too. We would like to
wear what we think "beautiful and inspirational" everyday. It would be
like wearing a charm.

I can look down to see the code on my front side of the T-shirt, uhm,
up-down. I can't see the back side myself but I would just feel happy
to be wearing something I love. Maybe the other programmers around me
would come to me and ask what that means, and I would proudly say,
"you know what? it's the code that does...!".

2007/5/17, Dan Bron <[EMAIL PROTECTED]>:
I call these phrases "jems":  J gems.

The problem with elegant phrases is they only impress if you already know the 
language.

Which is to say, it's hard to impress non-Jers with jems.

Non-Jers are more likely to be impressed by pretty pictures, and since graphics 
aren't defined by the J language, phrases which produce graphics can not be 
termed jems.

Jers, on the other hand, are more likely to be impressed by J phrases which 
make elegant of the language, and reduce complex word problems to minute J 
expressions (e.g. the Josephus Problem (A)).

I therefore conclude that the best candidates for jems are concise phrases 
which produce ASCII art.  Such phrases are poised to astound the elect and the 
hoi polloi alike.

Here's a great example:


          |._31]\,(,.~,])^:4,:'* '

                      *
                     * *
                    *   *
                   * * * *
                  *       *
                 * *     * *
                *   *   *   *
               * * * * * * * *
              *               *
             * *             * *
            *   *           *   *
           * * * *         * * * *
          *       *       *       *
         * *     * *     * *     * *
        *   *   *   *   *   *   *   *
       * * * * * * * * * * * * * * * *

This concise formulation of the Sierpinski Triangle is was a collaborative 
effort, with the final expression due to Raul Miller (B).

The creme de la creme are those jems which exploit subtle or surprising 
mathematical identities.  For example, John Randall pointed out that the 
triangle can be calculated with Pascal's Triangle mod 2 (C):


          ' *'{~'1'=(-|."_1[:":2|!/~)i.-16
                      *
                     * *
                    *   *
                   * * * *
                  *       *
                 * *     * *
                *   *   *   *
               * * * * * * * *
              *               *
             * *             * *
            *   *           *   *
           * * * *         * * * *
          *       *       *       *
         * *     * *     * *     * *
        *   *   *   *   *   *   *   *
       * * * * * * * * * * * * * * * *


Having said all that, one of my personal favorites doesn't produce ASCII art at 
all.  The problem (D) called for a verb which would create a table which could 
be visualized thus:

   http://upload.wikimedia.org/wikipedia/commons/4/43/JPEG_ZigZag.svg

which is obviously hard to represent in ASCII art.  Nevertheless, the solution 
in J was, to me, one of the best and most compelling examples of the language:

          zz  =:  ($ [: /:@; [: <@|.`<     /. i.)@,~

Again, this was a collaborative effort, but the final form was due to Oleg 
Kobchenko (E).  Depending on your taste, the use of a gerund argument to  \.  
is either innovative or precious (in the pejorative sense).  If the latter, you 
might prefer this formulation:

          zz  =:  ($ [: /:@; [: <@(A.~_2|#)/. i.)@,~

In either case:

          zz 4
       0  1  5  6
       2  4  7 12
       3  8 11 13
       9 10 14 15


-Dan

  (A)  http://www.jsoftware.com/jwiki/Essays/Josephus_Problem
  (B)  http://www.jsoftware.com/pipermail/programming/2006-September/003206.html
  (C)  http://www.jsoftware.com/pipermail/programming/2006-April/002043.html
  (D)  http://www.jsoftware.com/pipermail/programming/2006-November/004150.html
  (E)  http://www.jsoftware.com/pipermail/programming/2006-November/004159.html
----------------------------------------------------------------------
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