Earlier quoted context omitted.
> 1-indexed ranges can still be composable you could make them work, but improper abstraction leaks out in so many fugly ways. F.e. in Python you could compose functions, not only ranges. What do you pass in? Simple, [0, len(a)). What you get out? Simple, len(a). So you could operate on ranges composing function calls like in FP. Even works for unknown beforehand sequences/streams, just count along the sequence how m…
I don't buy it. Inclusive ranges are much more intuitive than left side inclusive and right side exclusive ranges. And they compose just fine; you just have to add a plus one at the right places. E.g. function mean(a, l, r) s = 0 N = r-l+1 for k in l:r s += a[k] end s/N, N end function mean2(a) N = length(a) lr1 = (1,div(N,2)) lr2 = (div(N,2)+1,N) v1, N1 = mean(a, lr1...) v2, N2 = mean(a, lr2...) N = N1+N2 (v1 * N1 +…
No, they are not. I'm talking about ability to build (and build upon) underlying algebraic structure.
ok, could you make a monoid out of your/Julia closed ranges? What would be a unit in this monoid? How would you make a null/empty range?