Alternative version of io2:

   io2a =: 2 : ',:&(,: (v L:_1)) (u&.>)'

   info =: ,.@([EMAIL PROTECTED] ; $ ; */@$ ; 3!:0)
   1{ <"_1 io2a info alltypes
+----+----+-------+----+-------------+----+-----------------------+
|+--+|+--+|+--+--+|+--+|+-----+-----+|+--+|+---------+-----------+|
||67|||67|||67|56|||67|||0 1 2|3 4 5|||67|||0 1  2  3|12 13 14 15||
|+--+|+--+|+--+--+|+--+|+-----+-----+|+--+||4 5  6  7|16 17 18 19||
|    |    |       |    |             |    ||8 9 10 11|20 21 22 23||
|    |    |       |    |             |    |+---------+-----------+|
+----+----+-------+----+-------------+----+-----------------------+
|+--+|+--+|+--+   |+--+|+--+         |+--+|+--+                   |
||0 |||1 |||1 |   ||1 |||1 |         ||1 |||1 |                   |
|+--+|+--+|+--+   |+--+|+--+         |+--+|+--+                   |
||  |||1 |||2 |   ||1 |||2 |         ||1 |||2 |                   |
|+--+|+--+|+--+   |+--+|+--+         |+--+|+--+                   |
||1 |||1 |||2 |   ||1 |||2 |         ||1 |||2 |                   |
|+--+|+--+|+--+   |+--+|+--+         |+--+|+--+                   |
||32|||32|||32|   ||32|||32|         ||32|||32|                   |
|+--+|+--+|+--+   |+--+|+--+         |+--+|+--+                   |
+----+----+-------+----+-------------+----+-----------------------+

versus:

   1{ <"_1 io2 info alltypes
+-----+-----+---------+-----+-------------+-------+-----------------------+
|+--+ |+--+ |+--+--+  |+--+ |+-----+-----+|+--+   |+---------+-----------+|
||67| ||67| ||67|56|  ||67| ||0 1 2|3 4 5|||67|   ||0 1  2  3|12 13 14 15||
|+--+ |+--+ |+--+--+  |+--+ |+-----+-----+|+--+   ||4 5  6  7|16 17 18 19||
|     |     |         |     |             |       ||8 9 10 11|20 21 22 23||
|     |     |         |     |             |       |+---------+-----------+|
+-----+-----+---------+-----+-------------+-------+-----------------------+
|+---+|+---+|+---+---+|+---+|+---+---+    |+-----+|+-----+-----+          |
||+-+|||+-+|||+-+|+-+|||+-+|||+-+|+-+|    ||+---+|||+---+|+---+|          |
|||0|||||0|||||0|||0|||||1|||||1|||1||    |||2  |||||2  |||2  ||          |
||+-+|||+-+|||+-+|+-+|||+-+|||+-+|+-+|    ||+---+|||+---+|+---+|          |
||| ||||| ||||| ||| |||||1|||||3|||3||    |||1 1|||||3 4|||3 4||          |
||+-+|||+-+|||+-+|+-+|||+-+|||+-+|+-+|    ||+---+|||+---+|+---+|          |
|||1|||||1|||||1|||1|||||1|||||3|||3||    |||1  |||||12 |||12 ||          |
||+-+|||+-+|||+-+|+-+|||+-+|||+-+|+-+|    ||+---+|||+---+|+---+|          |
|||4|||||4|||||4|||4|||||4|||||4|||4||    |||4  |||||4  |||4  ||          |
||+-+|||+-+|||+-+|+-+|||+-+|||+-+|+-+|    ||+---+|||+---+|+---+|          |
|+---+|+---+|+---+---+|+---+|+---+---+    |+-----+|+-----+-----+          |
+-----+-----+---------+-----+-------------+-------+-----------------------+

I wrote:
Date: Fri, 12 Oct 2007 13:47:23 +0100
...
    io2 =: 2 :',:&(,: (v L:0)) (u&.>)'

Credit to Tracy Harms for the idea of writing io2 as a modifier.

Tracy Harms wrote:
Date: Thu, 11 Oct 2007 11:15:39 -0700 (PDT)
...
This can be written as an adverb that takes any monad
and composes the input with output in the manner Raul
recently coded.

io=: 1 :',: u&.>'

NB. Example use:
  <io alltypes


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

Reply via email to