[1:10;] is simply a consequence of matrix literal syntax (like [1:10; 11:20]) and gets translated into vcat(1:10). It might be a bit confusing but there's no point in making it a special case.
On Thursday, 3 September 2015 17:28:27 UTC+1, Scott Jones wrote: > > To me, the use of ; within [ ] seems pretty confusing. > Elsewhere in Julia, it seems to mean, throw away the result, so I would > have expected [1:10; ] to be equivalent to []. > Why is [1:10;] (confusing, ; is not consistent with any other uses in > Julia), > preferred over [1:10...] (easy to understand, consistent with other uses > in Julia)? > > On Thursday, September 3, 2015 at 11:25:32 AM UTC-4, Jeff Bezanson wrote: >> >> For `[1:10]`, I recommend `collect(1:10)` or `[1:10;]`. Splatting >> should be avoided where possible. >> >> On Thu, Sep 3, 2015 at 11:22 AM, <[email protected]> wrote: >> > Early adopters shouldn't throw stones... :) But in fact I quite like >> the new >> > Dict syntax, which seems to be more explicit and readable. Curly braces >> seem >> > to be gainfully employed elsewhere doing type stuff. And experts can >> make >> > short cuts, either in Julia or in their editors... >> > >> > I confess I'm a bit puzzled by having to change `[1:10]` to >> `[1:10...]`, but >> > then again, `collect(1:10)` is more explicit and readable. So I think >> it's >> > progress. >> > >> > I suppose, as a former user of The Programming Language Formerly Known >> as >> > Mathematica", I might be more grateful than others for a less >> > punctuation-heavy language syntax. Mathematica Wizards can fluently >> read and >> > write code like this: >> > >> > lcm = Fold[#/#2/._~_~x_|_:>#x&,1,{##}]& >> > >> > but I'm happy with a more readable approach. >> >
