I forgot to address that, but yes, it was self answered. ` is a combining operation - a fundamental reason for obtaining a gerund is so that you can manipulate a sequence of verbs rather than just an individual verb. So in contexts like this where we only want a single verb, we combine it with the empty list.
Thanks, -- Raul On Sat, Mar 2, 2013 at 2:01 PM, Brian Schott <[email protected]> wrote: > Raul, > > Your explanations below help. > I don't believe you addressed this question, though (was that because > it was self-answered?): > > "I don't understand the mechanism of altSeq, in particular what the `'' at > the end is doing. Gerund with the empty string? Is that just to > enforce the creation of a gerund?" > > > On Sat, Mar 2, 2013 at 7:23 AM, Raul Miller <[email protected]> wrote: >> A generic problem with generalities is over-generalization. >> >> In this case, I was generalizing your original request by thinking >> about what would happen if I added more layers. My thoughts were >> about using a sequence of more than two gerunds, but I also tried to >> think about arguments greater than rank 0. >> >> Using {: with the x gerund becomes important if we have more than two >> of them. altSeq combines two gerunds and altSeq/ extends that to a >> sequence of arbitrarily many gerunds. [I could, instead, have forced >> an error for the case when more than two gerunds were present or >> documented that I was not supporting those cases.] >> >> The @] before the ^: is to prevent the verb derived by altSeq/ from >> seeing the left argument which will be the number of times we are >> applying this "alternating gerund verb". >> >> The (+ #) could indeed have become [ + 1: or something equivalent, in >> this particular version. However that takes me to the next issue: >> >> ("0) >> >> Is it worth thinking about arguments with greater than zero rank? If >> not, maybe this should just be removed. Or, maybe zero is the only >> rank that makes sense for the left argument and the right argument >> should be rank 1. Or maybe the right argument should be rank _1. Or >> maybe both are valid? If both are valid, I could remove ("0) or >> change it to ("0 _) or ("0 _1) and document the issue. Basically I >> think of ("0) in this context as a cheap hack to avoid dealing with a >> correctness issue where I currently have no requirements to motivate >> my choice. >> >> Of course, I didn't really have any requirements in the first place. >> For example, maybe my requirements should have been that I needed to >> represent the result as a polynomial. That would result in very >> different code and different possibilities for error cases. >> >> FYI, >> >> -- >> Raul >> >> On Fri, Mar 1, 2013 at 9:41 AM, Johann Hibschman <[email protected]> >> wrote: >>> Interesting. I was just churning through an explicit conjunction for the >>> two-monad case when I saw this. That was a fun little exercise, but then I >>> wondered about the general case, and then I saw your email. The timing was >>> excellent. >>> >>> The main complication that I was wondering about was having (, x`:6@{:) >>> rather than just (, x`:6). I can see that being useful if the previous >>> monad (y`:6@{:) had returned a vector rather than a scalar. It's a little >>> confusing because I'd call it a false parallel {: in (y`:6@{:). That one >>> was structural, all about assembling the sequence, while the other is an >>> extension to non-scalar returns. Of course, I could be misreading it. >>> >>> I don't understand the mechanism of altSeq, in particular what the `'' at >>> the end is doing. Gerund with the empty string? Is that just to enforce the >>> creation of a gerund? >>> >>> I'm not sure why Alternating includes @] before the ^:. That looks like it >>> should be a no-op to me. >>> >>> And, why (+ #)? I would have written ([: >: [). (+ #) is equivalent (since >>> 1=#scalar), and it's shorter, but is it also allowing for some other >>> possibility that I'm not seeing? >>> >>> Regards, >>> Johann >>> >>> > > -- > (B=) > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
