[Jprogramming] [Jgeneral] Un-puzzling expressions
Linda Alvord
lindaalvord at verizon.net
Tue Jul 17 06:15:32 UTC 2012
What a joy to receive your e-mail right after Raul's!
rou=: [: (* * |)&.+. [: ^ 0j2p1 * % * i.
rou ttem
3 : 0
z7=. i. y
p7=. % y
t8=. p7 * z7
s8=. ^ (0j6.2831853071795862) * t8
((* * |)&.+.)s8
)
roue=: 13 :'((**|)&.+.)^0j2p1 *(%y)*i.y'
rou 8
1 0.707107j0.707107 0j1 _0.707107j0.707107 _1 _0.707107j_0.707107 0j_1
0.707107j_0.707107
roue 8
1 0.707107j0.707107 0j1 _0.707107j0.707107 _1 _0.707107j_0.707107 0j_1
0.707107j_0.707107
(rou 8)-:roue 8
1
I can't imagine how long I might have struggled to get an explicit version
of the eight "eighth" roots of _1 if you hadn't explained this.
'ttem tted.ijs' will become a treasured script. Thanks
Linda
-----Original Message-----
From: programming-bounces at forums.jsoftware.com
[mailto:programming-bounces at forums.jsoftware.com] On Behalf Of Ian Clark
Sent: Monday, July 16, 2012 6:29 PM
To: programming at jsoftware.com
Subject: Re: [Jprogramming] [Jgeneral] Un-puzzling expressions
[Discussion moved to: programming]
Everyone knows (...don't they?) the use of '13 :' to transform a verb from
explicit to tacit form, as in:
13 : '(+/y) % #y'
+/ % #
Novices quickly yearn for '_13 :' to convert the other way, maybe like this?
(don't splutter) ...
_13 : '+/ % #'
(+/y) % #y
...only there isn't just one way of doing it. The result might just as well
be:
(+/ % #)y
viz: simply put '(...)y' round the given tacit verb. Or optionally:
'x(...)y' .
Then, treating J as an algebra (and knowing the rules) couldn't the
expression then simply be "multiplied out" to any desired level? (I'm being
intentionally naive.)
Can I propose the word "explicate" for this generalized process? Is
"explicate" already in use for something else? Or has
(tacit-->explicit) already got a perfectly good name? Art uses the word
"un-puzzling". Roger (Stokes) names his proposed verb: "explain".
There are in fact a lot of pages in the J wiki on the topic of "explication"
if I may call it that. Many seem to have been written in ignorance of the
others. It would be good to have a single page, well-signposted for
beginners, to pull all these different approaches together. Or even just to
list them. Coincidentally I'd already started building just such a roadmap
for my own use.
Meanwhile I heartily endorse Art's observation:
> Newcomers to J should be encouraged very early to use such tools,
> which supply multiple avenues to understanding concrete examples.
> Some of my own recent puzzlements might not have occurred if I had had
> a better grounding in the precise nature of the syntactic features of J.
and I like his block-diagram expansion of a given tacit verb. A formidable
extension of (5!:4).
I also like Roger's approach. Excellent for the raw novice. Though as the
novice becomes less raw s/he might soon yearn for something terser. Ideally
this would be a collapsed form of the verbose explication, but clearly
derived from it. Terse/verbose might be controlled by an optional left arg:
0 or 1. Maybe an intermediate level would be called for.
Me, I've had many bites at the "explicate" cherry, but eventually gave up in
the face of Ambrus's excellent script: tte.ijs, documented at:
http://www.jsoftware.com/jwiki/Scripts/TacitToExplicit
This script defines two words: "ttem" (monadic) and "tted" (dyadic).
I'd recommend them for close study. I often use "ttem" in practice and think
it's the handiest and clearest "explicate" of all.
Here's Ambrus's "ttem" in use on a stock example "nub" (m41 -in: Help
> Phr > 8A. Numbers & Counting). Note the extreme flexibility: it's
written as an adverb, so it can work on a (tacit) verb, not a (string)
expression. Nor, for that matter, is it confined to proverbs, unlike
5!:4 .
nub=: ((i.@#) = (i.~)) # ] NB. bracketed using 5!:6 to make the
process clearer...
nub ttem
3 : 0
]s0=. y i. y
]t0=. (i.@#)y
]r0=. t0 = s0
]r0 # y
)
The prefixes: ] are my own embellishment. They allow you to assign some test
data to global: y and then trace the "explication" by re-entering each line
in turn.
Ian
On Mon, Jul 16, 2012 at 3:57 AM, Arthur Anger <Anger at mit.edu> wrote:
> If you have been puzzled by the result--or non-result--from a
> published or personal expression, you may benefit from automated
> analyses of parenthesization, syntactic structure, and value production.
>
> Newcomers to J should be encouraged very early to use such tools,
> which supply multiple avenues to understanding concrete examples.
> Some of my own recent puzzlements might not have occurred if I had had
> a better grounding in the precise nature of the syntactic features of
> J.
>
> Such tools appear in script trace.ijs and the Foreign conjunction 5!:4.
> Some
> additions to those capabilities are now in script aatrace.ijs, linked
> via http://www.jsoftware.com/jwiki/ArtAnger :
>
> --pyr and parenpyr redisplay a quoted expression with each
> parenthetical subgroup raised one line above its context, forming
> pyramids of various heights, to improve visual recognition.
>
> --flowtree produces a "tree" with a downward "flow" of information (data).
> It
> deviates from simple tree structure when displaying hooks, forks,
> ties, adverbs, and most conjunctions, to try to clarify those more
> complex processing paths. When an adverb, rank specifier, or other
> conjunction controls a verb's input and output, that action is
> suggested by a modified data flow. A Hook, Fork, Tie, or
> Bond-repetition is noted explicitly with an H, F, T, or R.
>
> --flowtree also stores the same expression with inserted calls to a
> tracing adverb. Its execution report, of arguments supplied and
> results produced at those labeled points, can show very clearly how
> Insert applies a verb successively within a list, and how data are
> passed through the verb phrases in a Fork train.
>
> See the fuller summary at:
> http://www.jsoftware.com/jwiki/Essays/Un-puzzling
> expressions
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list