You can do m = [j for i = 1:5, j = 0:0.01:1]
Abel Soares Siqueira 2016-03-07 12:37 GMT-03:00 Tom Breloff <[email protected]>: > So in conclusion, I really was overusing collect(). > > > Yup... and this is one reason I think the change is valuable... it helps > make people think "why did they do this??" > > if there is a way to avoid collect() for a matrix operation, I'd love to >> know. > > > What type of operation do you mean? Maybe there's a way? If you're > referring to your example above, you can of course do: ones(5)*(0:0.01:1)' > > Or if you really want to take advantage of minimal > allocations: linspace(1,1,5)*(0:0.01:1)' > > (Of course the matrix allocation outweighs the temporaries in this > example...) > > > On Mon, Mar 7, 2016 at 10:08 AM, Daniel Carrera <[email protected]> > wrote: > >> Thanks. >> >> On 7 March 2016 at 15:10, Tamas Papp <[email protected]> wrote: >> >>> See >>> https://github.com/JuliaLang/julia/issues/7941 >>> and the related issues, particularly >>> https://github.com/JuliaLang/julia/issues/2488 >>> https://github.com/JuliaLang/julia/issues/3737 >>> >>> Best, >>> >>> Tamas >>> >>> On Mon, Mar 07 2016, Daniel Carrera wrote: >>> >>> > Hello, >>> > >>> > In the last major release of Julia some syntax was deprecated. For >>> example: >>> > >>> > {"a" => 3} # Deprecated. Use Dict("a" => 3) >>> > >>> > [1:10] # Deprecated. Use collect(1:10) >>> > >>> > There was also a change with the commas, but I can't remember what it >>> is. >>> > Some times I get an error saying that apparently I'm supposed to use a >>> > semicolon, but I can't remember when that happens. >>> > >>> > Anyway, I miss the earlier cleaner syntax. Mainly, I don't like >>> > "collect(1:10)". I don't mind Dict(), because it's not something I >>> write >>> > very often, and "Dict" is short enough. But I don't like having to >>> write >>> > "collect(1:10)" as often as I do. Can someone explain what happened? >>> What >>> > was wrong with the original syntax? MATLAB has managed to survive with >>> the >>> > [1:10] syntax for a long time, so I don't see why it's so terrible. >>> > >>> > In general, I like compact syntax and that is one of the reasons why I >>> > switched to Julia. I would rather not see Julia become more verbose >>> over >>> > time. >>> > >>> > Cheers, >>> > Daniel. >>> >>> >> >
