Here's a script dialog of "representation/copula". Run the script.
Note that there is no result for (x). Also I added x at the end which seems
to be worth including.
plus=: +
5!:1 <'plus'
noun=: 3 1 4 1 5 9
5!:1 <'noun'
increment=: 1&+
5!:1 <'increment'
NB.5!:2 y Boxed
nub=: (i.@# = i.~) # ]
5!:2 <'nub'
NB.5!:4 y Tree.
5!:4 <'nub'
NB.5!:5 y Linear
5!:4 <'nub'
5!:5 <'a' [ a=: o. i. 3 4
lr=: 3 : '5!:5 <''y'''
lr 10000$'x'
NB.5!:6 y
5!:6 <'nub'
NB.x 5!:7 y Explicit.
perm=: 3 : 0
z=. i.1 0
for. i.y do. z=.,/(0,.1+z){"2 1\:"1=i.>:{:$z end.
)
1 (5!:7) <'perm'
perm 3
$perm 3
NB. Copula
f=: 3 : 0
a=. +:y
b=: *:a
10*b
)
a=: b=: 678
a,b
f 3
a,b
x=: 'abc';'c'
(x) =: 3 4 ; 5 6 7
NB.Note that the parentheses around the name x
beta
'`sum sqrt'=: +/ ` %:
sum 3 1 4 2
sqrt 2
x
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Monday, March 9, 2015 11:18 PM
To: [email protected]
Subject: Re: [Jprogramming] linear boxed representation : A new
representation format for mixed type words
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
PJ> all 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>
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>
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>
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>
http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm