Try in APL ?.,/?a b c in which the bold stiles read <take> and <pick> resp. and in which a b and c are strings given as: a =. 'keep ' 'remove ' rather than 'keep remove' etc. which in my view is more clear in APL than it is in J (in which the blank is apparently an implicite separator and not a 'character'; why? it doesn't quite fit in my perception anyway). The only advantage of J is that you can send it by Internet, which in most cases is not our purpose. Jan Karman

Tue, 15 Sep 1998 03:00:00 GMT

Bj?rn Helgaso#2 / 7

J Challenge

Quote:

> Bjorn writes: > > For those of you who have not yet discovered the J challenge. > > Please look at the challenges there and try out a few things > > and compare then with the solutions.

> which in my view > is more clear in APL than it is in J (in which the blank is apparently > an implicite separator and not a 'character'; why? it doesn't quite > fit in my perception anyway).

In your APL apparantly the blank is some sort of operation while in J the operation is done by specific well defined and clear operation

;. defines the Cut operation

< is a left argument to cut and tells it to be boxed

2 is a right argument to cut telling cut to use the last character in the string as a separator. 2 means that the separator should be kept in the box.

A right argument to cut of _3,_2,_1,0,1,2 and 3 all give you different boxes.

_2 gives you same kind of box as 2 but removes the separator. In this case the last character the blank.

1 would use the first character and keep it.

_1 would also use the first character but remove it from the box.

0 reverses the chars in the box

3 splits it into ever smaller boxes

Quote:

> The only advantage of J is that you can send it by Internet,

I can think of a few more advantages.

It is a bit strange to think that 1982 I remember sitting in the auditorium in Heidelberg watching Ken Iverson and Jim Brown debating on the stage about exactly this phenomenon that had just been introduced in APL2.

Giving a meaning to blank like: a=. 'keep ' 'remove '

In APL2 this was supposed to have a meaning while Ken did not like that. In J this gives a syntax error.

At the time I did not understand the significance of the debate. I had just been introduced to APL2 and thought it was great and I did not underestand why Ken did not just love it like I did.

It took me several years of using APL2 and then converting to SAX and eventually J before I began to understand the difference.

Needless to say that I now understand that Ken was right way back then in Heidelberg.

It is a bit strange to see this debate still being on. I can understand why people do not understand.

It is often difficult to understand Ken.

I have come to the conclusion that if Ken says something I just accept it hoping I will be fortunate enough to understand it in a few years time.

--

http://www2.simi.is/~gosi http://www.jsoftware.com

Wed, 16 Sep 1998 03:00:00 GMT

Jan Karma#3 / 7

J Challenge

Bjorn, The two characters I'm talking of appear in my editor as bold stiles. The first character 'cross' should be read <mix> rather than <take> The second 'oe' is meant to be <first> rather than <pick> (I don't have the tools (nor the time to explore them)to display APL characters properly on Internet). I'm not taking in doubt anything Mr Iverson is saying. I just don't see in your example an explicit "J Challenge", or more than e.g. an APL Challenge. Jan

Wed, 16 Sep 1998 03:00:00 GMT

Kirk B. Ivers#4 / 7

J Challenge

Quote:

>a =. 'keep ' 'remove ' rather than 'keep remove' etc. which in my view >is more clear in APL than it is in J (in which the blank is apparently >an implicite separator and not a 'character'; why? it doesn't quite >fit in my perception anyway).

As Bjorn pointed out, there is nothing special about the blank which appeared in the constants except for the fact that the cut conjunction (;.) used the last item in the list (a blank) as the delimiter.

The rest is as you guessed: J's <;.2 'this and that ' is APL2's 'this ' 'and ' 'that '

The final line: (0&{&> , ' - '"_ , ;)&> all generates a table of function name and definition, eg: rlb - remove leading blanks

I'd be interested in seeing the APL2 expression which generates a similar result to this expression. Also, I'd like to see the APL2 solution to the challenge posed here -- I would think its defined operators would allow for a solution along the lines of the J solution given at the web site.

-------------------------------------

For those interested, here's more information about the "cut" conjunction which came under discussion here:

The cut conjunction (;.) splits the argument along the leading axis ("items" in J-speak), and applies the verb left argument to each partition. The number on the right determines how the partitions are defined: 1 and _1 uses the leading item as the delimeter; 2 and _2 uses the trailing item. The negative cases differ in that the delimiters are not included in the partitions. Some examples using box (<) should help: <;.1 '/the/delimiters/are/slashes' +----+-----------+----+--------+ |/the|/delimiters|/are|/slashes| +----+-----------+----+--------+ <;._1 '/like/above/but no/delims included' +----+-----+------+---------------+ |like|above|but no|delims included| +----+-----+------+---------------+

firstword=. {.~ i.&' ' NB. return first word in a string firstword;._2 list NB. result is table of first words. This lines read

It list NB. Could have just been: firstwords=. ({.~ i.&' ');._2

Also, given the example list, we can also:

lines=. <;._2 list NB. Return list of boxes for each line.

A paragraph is indicated by an empty line, now an empty box: para_delim=. <'' NB. paragraph delimiter ]text=. <;._2 lines,para_delim +----------------------------------------------------+----... |+-------------------+---------------+--------------+|+---... ||This is a series of|lines which are|read by 0 : 0.|||It ... |+-------------------+---------------+--------------+|+---... +----------------------------------------------------+----...

Result of the above is a list of boxes each representing a paragraph. Inside each box is a list of boxes containing the lines in that paragraph. Once text is defined, you can do the following: #text NB. Number of paragraphs 2 #&>text NB. Number of lines in each paragraph 3 2

x#&.>text NB. Pick out those lines +---------------------+-------------------------+ |+-------------------+|+-----------------------+| ||This is a series of|||list of these contents.|| |+-------------------+|+-----------------------+| +---------------------+-------------------------+

--

Thu, 17 Sep 1998 03:00:00 GMT

Roger Hu#5 / 7

J Challenge

that I posted Sunday at 14:22 GMT was terribly garbled. I believe the garbling was caused by a combination of the following two factors:

. The article contains a quotation from Jan Karman containing APL characters in the upper ASCII range (>127). The presence of these characters in my article caused some software/network along the way, but definitely after leaving my machine and my e-mail service provider, to replace them and certain _other_ characters by "=xx", where xx is the ASCII index in hex. In particular, the = sign itself was replaced by "=3D" (thus "=." became "=3D."), and (mysteriously) some blanks were replaced by "=20".

Without intending to, I managed to demonstrate once again the havoc that APL characters can cause. It is ironic that in his original post Jan Karman said, "The only advantage of J is that you can send it by Internet, which in most cases is not our purpose".

. The display of the boxed array "all" was more than 80 characters wide. My e-mail software wrapped these lines in a non-fortuitous manner.

Herewith, the article as I intended, hopefully not to be garbled again:

> Try in APL > {hex 86}{hex b0}.,/{hex 9c}{hex a8}{hex a8}a b c > in which the bold stiles read <take> and <pick> resp. > and in which a b and c are strings given as: > a =. 'keep ' 'remove ' rather than 'keep remove' etc. which in my view ...

As far as I can tell, the APL expression is

{first}{jot}.,/{disclose}{each}{each}a b c

which only generates the result "all", but is silent on how the final array of acronyms and full texts is to be computed.

There is another solution in J that uses the monad ;: (word formation) to advantage. ;: applies the J rhematic rules to produce a list of the words in the string argument, individually boxed. ;: is quite efficient, and is often applicable to ordinary text, as here:

> It is a bit strange to think that 1982 I remember sitting in the > auditorium in Heidelberg watching Ken Iverson and Jim Brown debating > on the stage about exactly this phenomenon that had just been introduced > in APL2.

> Giving a meaning to blank like: > a=. 'keep ' 'remove '

> In APL2 this was supposed to have a meaning while Ken did not like > that. In J this gives a syntax error.