Post History
BQN, 15 bytesSBCS {π¨(1+β’π-)βπ©β>0} Run online! A block function that takes $t_1$ as the left argument π¨ and $t_2$ as the right argument π©. In BQN, π indicates recursion on the current block ...
Answer
#1: Initial revision
# [BQN](https://mlochbaum.github.io/BQN/), 15 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup> ``` {π¨(1+β’π-)βπ©β>0} ``` [Run online!](https://mlochbaum.github.io/BQN/try.html#code=U1Mg4oaQIHvwnZWoKDEr4oqi8J2Vii0p4p+c8J2VqeKNnz4wfQoKU1PCtMKo4p+oICMgRm9sZCAowrQpIHRvIGFwcGx5IHRvIGxpc3RzCiAg4p+oMTIwLDcx4p+pCiAg4p+oMTAxLDQy4p+pCiAg4p+oNTAwLDQ5OeKfqQogIOKfqDM4Nywx4p+pCiAg4p+oMywtMTI44p+pCiAg4p+oLTIsM+KfqQogIOKfqDMsMuKfqQrin6k=) A block function that takes $t_1$ as the left argument `π¨` and $t_2$ as the right argument `π©`. In BQN, `π` indicates [recursion](https://mlochbaum.github.io/BQN/doc/block.html#self-reference) on the current block function. Inside the function the idea is just to return 0 if `π¨β€0` and otherwise advance the sequence by one, recurse, and add one to the resulting sequence length. ``` {π¨(1+β’π-)βπ©β>0} 0 # Default result of 0 π¨ β> # If π¨>0: ( )βπ© # Use π© as right arg (left is still π¨) β’ - # Right argument β’ and difference - π # Recurse 1+ # Add one ``` The unrelated 0s for sequence length and minimum `π¨` are combined by making 0 the right argument and using Repeat (`β`). With 0 repetitions, Repeat will return the right argument 0, and with 1 repetition, it will call the operand function, which immediately replaces 0 with `π©` using [After](https://mlochbaum.github.io/BQN/tutorial/combinator.html#before-and-after) (`π©` is a number, so it acts as a constant function).