Arc Forumnew | comments | leaders | submitlogin
1 point by connellybarnes 5882 days ago | link | parent

I like MATLAB syntax best. 1:5 builds a range. 1: should build the infinite range, but MATLAB is crippled and only lets you do x(1:end). In Lisp syntax, (x 1:) would be item 1, 2, etc of x, (x lo:hi) would be lo, ..., hi-1. I'd also find this convenient because I often need to loop from 0 to infinity and 1 to infinity. Although Python's syntax of using negative numbers to index from the end of the list is far more convenient than 'end' in MATLAB, and it goes without saying that MATLAB's 1-based indexing is Satanic.

Using lots of syntax (e.g. Python's range(a, b)) for range construction is completely unacceptable, and using different syntax to index into an array and construct a range is annoying, due to violating fairly basic notions of beauty in mathematics (Equal things can be replaced by each other; Use one abstract syntax to cover lots of ideas, instead of lots of syntax to cover few ideas). Also, if one leaves out sane floating-point range construction methods, then they get added over and over again in 3rd party libraries (e.g. numpy.arange in Python).