I've been playing with a Degree type in Julia, and have set it up so I can
use ° to construct Degrees:
module Degrees
export Degree, °
immutable Degree{T<:Number} <:Number
d::T
end
immutable DegreeSign end
const ° = DegreeSign()
*(num::Number, s::DegreeSign) = Degree(num)
Base.show(io::IO, d::Degree) = print(io, "$(d.d)°")
end
I can successfully construct a array of Degrees with a for loop like so:
for i in 1:10
i°
end
But the same thing doesn't work in a comprehension:
[ i° for i in 1:10]
This leads to a error complaining that `i° not defined`. It sounds to me
like it is evaluating `i°` before i has a value assigned to it. What's
going on here?