Pascal Jasmin wrote:
PJ>
PJ> if you want to pass a gerund (or boxed noun) to a function, it must
PJ> either be all verbs (with single adverbs as strings permitted), or all
PJ> nouns.  So this is possible.
PJ>   '`a b c' =. '/';+`- 
PJ> but it fails for an adverb phrase.
PJ>   '`a b c' =. '/\';+`- 
PJ> |spelling error

You are missing out on the more general notion of Atomic Representations.

Gerunds are arrays of verb ARs.  ARs are uniquely defined for *any* syntactic
class, though, and you are free to mix them:

   a =. +
   b =. -
   c =. /\
   d =. 42

   (ar =. 5!:1) ;:'a b c d'
+-+-+---------+------+
|+|-|+-+-----+|+-+--+|
| | ||5|+-+-+|||0|42||
| | || ||/|\|||+-+--+|
| | || |+-+-+||      |
| | |+-+-----+|      |
+-+-+---------+------+

   '`aa bb cc dd' =. ar ;:'a b c d'

   aa
+
   bb
-
   cc
/ \
   dd
42

   nameclass ;:'aa bb cc dd'
3 3 1 0

   (aa cc ,: bb cc) 1 2 3
1  3 6
1 _1 2

Further reading:  http://jsoftware.com/help/dictionary/dx005.htm
for 5!:1 (and, if you like, its reverse 5!:0);  then re-read
http://jsoftware.com/help/dictionary/d001.htm  to re-check
how the back-tick in '`a b c' is defined.

Further further reading:
Bernecky, Robert, and R.K.W. Hui, Gerunds and Representations, APL91, ACM.

                                                        Martin

PS:  Apropos "reading":  I cannot read your (or anybody else's) message
parts with unicode box characters on the machine which receives the
newsified forum messages.  If you want me to be able to read those
message parts, please adhere to the Forum rules as stated in
<http://www.jsoftware.com/jwiki/System/Forums>:

        **Formats**

        The mailing lists send out emails in plain text format. For
        best results, please send messages to the forum in this
        format.

        When copying J session output to an email, first set
        box-drawing characters to Ascii. The IDEs have a menu item
        for this, e.g. in J8 Qt, select View|Toggle Ascii Box
        Drawing.

Having said that, and *not* having been able to read your code, just
guessing from your "Subject:  I'm afraid you are re-inventing a wheel.


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

Reply via email to