Rank.

The rank of *: is 0.

Thus  ... @ *: has rank 0.

The rank of fork is _ .

*: @: fork   (equivalent to [: *: fork)   has rank _  , as does (*: @ fork)

Henry Rich

On 2/12/2023 4:46 PM, More Rice wrote:
Masters,

I understand that there is an excellent reference implementation of varp in
addons/stats/base/univariate.ijs to learn from, but I'm trying to do
exercises to solidify my understanding of using verb trains/hooks, and the
difference when using Atop.

I've 2 versions of varp.

#1 below is typical of what some of you do (credit: Bob's "Maximum
Consecutive 1's in J."  Excellent video!  Thank you. I wish there were more
of these.) - using cap when we want to string monadic verbs sequentially.
No problem there.

NB. works - using hook/fork/cap
myvarp1 =: # %~ [: +/ [: *: (-+/%#)

NB. works - using hook/fork/Atop and no cap
myvarp2  =: # %~ +/ @ (*: @ (-+/%#))


#2 above, for some reason, I need an extra pair of parentheses to the right
of the 1st @ for it to work. I don't get why.  For example, the following
is broken.

NB. It gives me a list instead :(

myvarp_broken =: # %~ +/ @ *: @ (-+/%#)


Why are they (the missing parentheses w.r.t. #2) needed?



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

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

Reply via email to