While playing around with J (link), I found that you can create a sequence of shape N0 N1 ... NK with i. taking a list  as its parameters. Since i. creates a range 0 .. RHS and >: increments each value in a range, i. >: i. RHS creates a non-empty range. We can use , to flatten it and +/ to summate it. Given an RHS, this looks like:+/ , i. >: i. RHSOne can trivially convert this to a tacit expression using an extended monadic fork and capping the left branch [:.[: +/ [: , [: i. [: >: i.However, I find this rather bulky and that it could be more concise. How might I make it more so?I have found a more concise solution that I would also like feedback on. Observing that the last members in each of the lists (before being summated) is (n-1)!. Since , flattens the list, we can emulate this with i., and since the endpoint is not included, we have another solution:+/ i. ! RHSConverting this to a tacit expression in the same way as above yields:[: +/ [: i. !However, I do not know of a better method for converting a monadic sequence of operations to a tacit verb.Moving some verbs into variables:sum =: +/cap =: [:cap sum cap i. !How can this code be improved?Some example input/outputs (work for both functions).   sum =: +/   cap =: [:   sp =: cap sum cap i. !   max =: 8   (2 , max) $ (i.max) , (sp0 i.max)0 1 2  3   4    5      6        70 0 1 15 276 7140 258840 12698280The first row is input to sp, and the second row is its output.
Summative Pattern
combinatorics;j