IMO the parametric method with multiple dispatch is more Julian.
or, the more specific
function read_integer(prompt::String="")::Int
print(prompt)
str = chomp(readline())
return parse(Int, str)
end
On Friday, October 28, 2016 at 1:17:54 AM UTC-4, Jeffrey Sarnoff wrote:
>
> with Yichao's help,
>
>
>
> typealias ParseableNumber Union{Float64, Float32,
with Yichao's help,
typealias ParseableNumber Union{Float64, Float32, Signed, Unsigned, Bool}
"""
`input{T<:ParseableNumber}(::Type{T}, prompt::String="")::T`
Read an integer or a floating point value from STDIN.
The prompt string, if given, is printed to standard output without a
trail
Thank you, that is helpful.
On Friday, October 28, 2016 at 12:22:37 AM UTC-4, Yichao Yu wrote:
>
> On Fri, Oct 28, 2016 at 12:01 AM, Jeffrey Sarnoff
> > wrote:
> > And although readline() yields a String, if you are asking for, say, a
> Int
> > or a Float64 value, you can add a second version
On Fri, Oct 28, 2016 at 12:01 AM, Jeffrey Sarnoff
wrote:
> And although readline() yields a String, if you are asking for, say, a Int
> or a Float64 value, you can add a second version of `input`:
>
> ```
> typealias ParseableNumber Union{Float64, Float32, Signed, Unsigned, Bool}
>
> """
> `in