From 0d31ea0ac1850a01560523ffce885ae6d903fa89 Mon Sep 17 00:00:00 2001 From: Ojasv Date: Wed, 22 Jan 2020 05:35:09 +0530 Subject: [PATCH 1/4] Updated the documentation for Range function --- Make.inc | 1 + base/range.jl | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Make.inc b/Make.inc index b3a042d119931..bcca49d8aa8f9 100644 --- a/Make.inc +++ b/Make.inc @@ -1408,3 +1408,4 @@ print-%: # Literal values that are hard to use in Makefiles otherwise: COMMA:=, SPACE:=$(eval) $(eval) +USE_BINARYBUILDER_LLVM=0 \ No newline at end of file diff --git a/base/range.jl b/base/range.jl index 857d612d05360..1347e115d9b18 100644 --- a/base/range.jl +++ b/base/range.jl @@ -53,11 +53,16 @@ Given a starting value, construct a range either by length or from `start` to `s optionally with a given step (defaults to 1, a [`UnitRange`](@ref)). One of `length` or `stop` is required. If `length`, `stop`, and `step` are all specified, they must agree. -If `length` and `stop` are provided and `step` is not, the step size will be computed -automatically such that there are `length` linearly spaced elements in the range (a [`LinRange`](@ref)). +In most cases if `step` and `stop` are provided and `length` is not, the overall range length will be computed automatically such that the elements are `step` spaced (a [`StepRange`](@ref)). -If `step` and `stop` are provided and `length` is not, the overall range length will be computed -automatically such that the elements are `step` spaced (a [`StepRange`](@ref)). +In case the elements are not simple numeric, elements are spaced using (a [`LinRange`](@ref)) +# Example + +```jldoctest +julia> range([1,2], [3,4], length=10) +10-element LinRange{Array{Int64,1}}: + [1.0, 2.0],[1.22222, 2.22222],…,[2.77778, 3.77778],[3.0, 4.0] +``` `stop` may be specified as either a positional or keyword argument. From b9de7593e199ce66496821505fa65c84d6fc1fdc Mon Sep 17 00:00:00 2001 From: Ojasv Date: Wed, 22 Jan 2020 18:55:18 +0530 Subject: [PATCH 2/4] Revised range documentation commit --- Make.inc | 1 - base/range.jl | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Make.inc b/Make.inc index bcca49d8aa8f9..b3a042d119931 100644 --- a/Make.inc +++ b/Make.inc @@ -1408,4 +1408,3 @@ print-%: # Literal values that are hard to use in Makefiles otherwise: COMMA:=, SPACE:=$(eval) $(eval) -USE_BINARYBUILDER_LLVM=0 \ No newline at end of file diff --git a/base/range.jl b/base/range.jl index 1347e115d9b18..8815ed216b433 100644 --- a/base/range.jl +++ b/base/range.jl @@ -53,9 +53,13 @@ Given a starting value, construct a range either by length or from `start` to `s optionally with a given step (defaults to 1, a [`UnitRange`](@ref)). One of `length` or `stop` is required. If `length`, `stop`, and `step` are all specified, they must agree. -In most cases if `step` and `stop` are provided and `length` is not, the overall range length will be computed automatically such that the elements are `step` spaced (a [`StepRange`](@ref)). +If numeric `length` and `stop` values are provided but `step` is not specified, the return value is +a [`StepRangeLen`](@ref) with a computed step. However, for non-numeric values of +`start` and `stop` (such as arrays), the `range` function instead returns a +[`LinRange`](@ref) object. (Both `StepRangeLen` and `LinRange` correspond +to equally spaced points up to roundoff errors, but deal with floating-point rounding +slightly differently.) -In case the elements are not simple numeric, elements are spaced using (a [`LinRange`](@ref)) # Example ```jldoctest From 2f133bb9865eaa44124a0acdf904af36ab2fbf22 Mon Sep 17 00:00:00 2001 From: kamalojasv181 <43926001+kamalojasv181@users.noreply.github.com> Date: Thu, 23 Jan 2020 02:09:23 +0530 Subject: [PATCH 3/4] Updated Range Documentation --- base/range.jl | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/base/range.jl b/base/range.jl index 8815ed216b433..49a6d43b22723 100644 --- a/base/range.jl +++ b/base/range.jl @@ -53,20 +53,8 @@ Given a starting value, construct a range either by length or from `start` to `s optionally with a given step (defaults to 1, a [`UnitRange`](@ref)). One of `length` or `stop` is required. If `length`, `stop`, and `step` are all specified, they must agree. -If numeric `length` and `stop` values are provided but `step` is not specified, the return value is -a [`StepRangeLen`](@ref) with a computed step. However, for non-numeric values of -`start` and `stop` (such as arrays), the `range` function instead returns a -[`LinRange`](@ref) object. (Both `StepRangeLen` and `LinRange` correspond -to equally spaced points up to roundoff errors, but deal with floating-point rounding -slightly differently.) - -# Example - -```jldoctest -julia> range([1,2], [3,4], length=10) -10-element LinRange{Array{Int64,1}}: - [1.0, 2.0],[1.22222, 2.22222],…,[2.77778, 3.77778],[3.0, 4.0] -``` +If `length` and `stop` are provided and `step` is not, the step size will be computed +automatically such that there are `length` linearly spaced elements in the range. `stop` may be specified as either a positional or keyword argument. From d6fa884552a6860bb9df9acb82a5352e65ddeb6c Mon Sep 17 00:00:00 2001 From: Ojasv Date: Mon, 27 Jan 2020 06:44:17 +0530 Subject: [PATCH 4/4] Added what happens if length is not provided --- base/range.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/base/range.jl b/base/range.jl index 49a6d43b22723..5c3ffa4d480a4 100644 --- a/base/range.jl +++ b/base/range.jl @@ -56,6 +56,9 @@ One of `length` or `stop` is required. If `length`, `stop`, and `step` are all If `length` and `stop` are provided and `step` is not, the step size will be computed automatically such that there are `length` linearly spaced elements in the range. +If `step` and `stop` are provided and `length` is not, the overall range length will be computed +automatically such that the elements are `step` spaced. + `stop` may be specified as either a positional or keyword argument. !!! compat "Julia 1.1"