If you’re trying this out in the REPL, you might have stumbled on the fact
that list comprehensions currently aren’t type stable, unless you tell
Julia the type of the elements. So instead of Xinput =
[Array{Float64}(InnerArrayPts) for r in 1:OuterArrayPts] in your setup, do
Xinput
=
Many thanks!
alan
On 29 Sep 2015, at 13:04, Tomas Lycken wrote:
> makes a difference in this specific case is a little beyond me, but an
> educated guess says that with that guarantee, it is possible to know what
> type Array(Float64, InnerArrayPts) will return, making
Type-inference in the REPL usually doesn’t give you as tight types as you’d
like, mainly because it has to give room for what you *might* do in the
future. Declaring variables const in the REPL (i.e. in global scope) helps
with that, since it gives type-inference some guarantees that the
Thanks Tomas, works perfectly.
I was testing out some code in the REPL... Relatedly and without abusing
the thread too much, I wondered if you might be able to help me understand
why the setting InnerArrayPts as const created the desired type stable
array comprehension? Namely,
const