Alex wrote:
> The solution that was provided was:
> }.@:({.@>) a
> Since I've don't use "Verb Sequences", my solution was:
> }. {. "1 > a
Either I've misunderstood you, or you've misunderstood Henry ('s book). These
two examples may do the same thing, but the first uses a tacit verb and the
second an expression.
Essentially, your first example is how you would rewrite your second example as
a reusable, tacit verb. To put it another way, if you had to do }. {. "1 > a
twice, how would you package that expression up as a reusable piece of code?
Of course, you could write foo =. 3 : '}. {. "1 > y' . But you could also
write foo =. }.@:({.@>) .
> So I am wondering if anybody has good examples where I would
> absolutely need to use verb sequencing
Verb sequencing is never required, because tacit code is never required. But
if you do write tacit code, you can't avoid verb sequences (one way or
another). There is probably a mechanical way to rewrite sequences such that
all instances of @ and @: are removed, but the results would be long, hard
to read, kludgy, and inefficient (e.g. using a lot of boxing & unboxing).
Try rewriting the following as tacit verbs without using @ or @: :
Y =: 2+i. 10
[EMAIL PROTECTED]: Y
1 1 2 1 2 1 3 2 2 1
Y =: #: 10 ?. 100
10&[EMAIL PROTECTED] Y
1345 156 2456 12345 135 134 34 46 4 123456
Y =: i. 4 2
<@i. Y
+-+-----+--------------+--------------------+
| |0 1 2| 0 1 2 3 4| 0 1 2 3 4 5 6|
| |3 4 5| 5 6 7 8 9| 7 8 9 10 11 12 13|
| | |10 11 12 13 14|14 15 16 17 18 19 20|
| | |15 16 17 18 19|21 22 23 24 25 26 27|
| | | |28 29 30 31 32 33 34|
| | | |35 36 37 38 39 40 41|
+-+-----+--------------+--------------------+
Y =: _4 }:\ 0&".;._2 noun :0
0.971444 1.02703 1.08578
0.971778 1.0574 1.15056
0.971756 1.05538 1.14619
0.993723 1.17813 1.39672
0.992743 1.2449 1.56111
0.992862 1.23705 1.5413
0.998822 1.2964 1.68263
0.998688 1.36822 1.87448
0.998552 1.43703 2.06803
)
(-/ .*)@%. Y
_561830 _31029.4 1429.68
When you're done, compare your verbs to the original in length, elegance, and
efficiency.
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm