I’d also propose adding
linspace(Vector{Float64},0,100)
linspace(Range,0,100)
linspace(LinSpace{Float64},0,100)
as constructors that return the corresponding type. That way Christoph can use
the linspace(Vector{Float64},0,100) version in his teaching.
> On 30 Aug 2016, at 12:13 PM, Chris Rackauckas <[email protected]> wrote:
>
> I just think the moment you start mixing default behaviors, you teaching
> becomes exponentially harder. I found range objects not that hard to teach,
> just "it uses an abstract version of an array to not really build the array,
> but know what the value would be every time you want one. If you want the
> array, just use collect()". I think it should just standardize like that: in
> every case where possible (linspace, range, eye, etc), the default option is
> the abstract version which gives better performance/memory usage, but at any
> time with any of them, you can collect() them into an array. However, if some
> are arrays and some are not, that's when confusion happens (especially when
> there's two "standard" ways of doing it, when one isn't supposed to be
> standard because it's not performant?).
>
> I don't think that being too lazy to write collect() is a good reason to fill
> Base with extra lower performing methods, making a minefield for newcomers in
> the docs. Instead, the docs for something like `I` should just say it's an
> operator which uses dispatch to achieve what it's doing, but if you need the
> array, use `collect()` (though `I` doesn't work here because of the size
> issue, but you get the point). This gives a way to be compatible with MATLAB
> while at the same time showing the better way to achieve the same goal.
>
> On Monday, August 29, 2016 at 6:41:54 PM UTC-7, Christoph Ortner wrote:
>
> (a) teaching: it is easy to explain to beginners what an array is, not so
> much abstract range objects
>
> (b) occasionally I actually need the vector and am just too lazy to write
> collect
>
> (c) compatibility with history (i.e. Matlab)
>
> I appreciate that all of these are to some extent personal preference.
>
>
> On Monday, 29 August 2016 23:43:31 UTC+1, Júlio Hoffimann wrote:
> Christoph,
>
> Can you elaborate on why you want to have both? Also, why you wanted the
> non-lazy linspace? If I understood correctly, you're talking about returning
> a array with allocated memory versus a range object, isn't the latter always
> preferred? I don't understand.
>
> -Júlio
>