¿Puedo agregar información de tipo a los argumentos que son funciones en Julia?
¿Puedo agregar información de tipo a los argumentos que son funciones?
Considere el siguiente ejemplo:
function f{T} (func, x::Int)
output = Dict{Int, Any}()
output[x] = func(x)
return output
end
No me gusta eso tengo que decirAny
para el tipo de valor del diccionario. Prefiero hacer lo siguiente:
function f{T} (func::Function{Int->T}, x::Int)
output = Dict{Int, T}()
output[x] = func(x)
return output
end
¿Puedo proporcionar consejos tipo de funciones como esta? Quiero decir lo siguiente
f :: (Int -> T), Int -> Dict{Int, T}