Re: [julia-users] Re: Input a data from the console

2016-10-28 Thread Ismael Venegas Castelló
IMO the parametric method with multiple dispatch is more Julian.

Re: [julia-users] Re: Input a data from the console

2016-10-27 Thread Jeffrey Sarnoff
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,

Re: [julia-users] Re: Input a data from the console

2016-10-27 Thread Jeffrey Sarnoff
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

Re: [julia-users] Re: Input a data from the console

2016-10-27 Thread Jeffrey Sarnoff
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

Re: [julia-users] Re: Input a data from the console

2016-10-27 Thread Yichao Yu
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