On Wed, Jan 23, 2013 at 3:51 PM, Thomas Costigliola <[email protected]> wrote:
> BTW, I miss being able to do this
>
> <@(+:`*:`%)/. 3 4 5 NB. Removed from language!

You could use something like this:

Atop=: 2 :0
  if. _1 = nc<'m' do. m=. {.u`'' end.
  if. _1 = nc<'n' do. n=. {.v`'' end.
  m (4 :'{. (x`:6)@(y`:6)`''''')"0 n
)

Atop is like @ but it works on gerunds, and always returns a gerund.

   < Atop [
+---------+
|+-+-----+|
||@|+-+-+||
|| ||<|[|||
|| |+-+-+||
|+-+-----+|
+---------+
   < Atop [ `:6
<@[
   < Atop (1:`2:`3:)
+----------+----------+----------+
|+-+------+|+-+------+|+-+------+|
||@|+-+--+|||@|+-+--+|||@|+-+--+||
|| ||<|1:|||| ||<|2:|||| ||<|3:|||
|| |+-+--+||| |+-+--+||| |+-+--+||
|+-+------+|+-+------+|+-+------+|
+----------+----------+----------+

If you wanted, you could go a step further and build something that
generates definitions like Atop given a string argument representing
the gerund.

require 'strings'
ggc=: (0 :0)(2 :0) NB. generate gerund conjunction
  2 :(m rplc '@';n)
)
  if. _1 = nc<'m' do. m=. {.u`'' end.
  if. _1 = nc<'n' do. n=. {.v`'' end.
  m (4 :'{. (x`:6)@(y`:6)`''''')"0 n
)

Atop=: '@'ggc
Compose=: '&'ggc
...

FYI,

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

Reply via email to