RRange.Ruby (REnum v0.8.0)
Summarized all of Ruby's Range functions. Functions corresponding to the following patterns are not implemented
- When a function with the same name already exists in Elixir.
- When a method name includes
!
. - %, ==, ===
Link to this section Summary
Functions
Returns the first element of range.
Returns true if list1 == list2.
Returns the last element of range.
Returns Stream that from given range split into by given step.
Executes Enum.each
to g given range split into by given step.
Link to this section Functions
Link to this function
begin(arg)
Specs
Returns the first element of range.
Examples
iex> RList.begin(1..3)
1
Link to this function
cover?(range, n)
See Enum.member?/2
.
Link to this function
end(range)
See RRange.Ruby.last/1
.
Link to this function
eql?(range1, range2)
Specs
Returns true if list1 == list2.
Examples
iex> 1..3
iex> |> RList.eql?(1..3)
true
iex> 1..3
iex> |> RList.eql?(1..4)
false
Link to this function
inspect(range)
See Kernel.inspect/1
.
Link to this function
last(arg)
Specs
Returns the last element of range.
Examples
iex> RList.last(1..3)
3
Link to this function
step(arg, step)
Specs
Returns Stream that from given range split into by given step.
Examples
iex> RList.step(1..10, 2)
iex> |> Enum.to_list()
[1, 3, 5, 7, 9]
Link to this function
step(arg, step, func)
Specs
Executes Enum.each
to g given range split into by given step.
Examples
iex> RList.step(1..10, 2, &IO.inspect(&1))
iex> |> Enum.to_list()
# 1
# 3
# 5
# 7
# 9
:ok
Link to this function
to_s(range)
See Kernel.inspect/1
.