Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9033b217d9 | ||
|
|
1d9548fd28 | ||
|
|
9a6c195880 |
@@ -1,5 +1,6 @@
|
||||
REBAR := rebar
|
||||
DOCS := v1.0
|
||||
CANONICAL := stable
|
||||
ELIXIRC := bin/elixirc --verbose --ignore-module-conflict
|
||||
ERLC := erlc -I lib/elixir/include
|
||||
ERL := erl -I lib/elixir/include -noshell -pa lib/elixir/ebin
|
||||
@@ -125,8 +126,9 @@ clean_exbeam:
|
||||
|
||||
#==> Release tasks
|
||||
|
||||
SOURCE_REF = $(shell head="$$(git rev-parse HEAD)" tag="$$(git tag --points-at $$head | tail -1)" ; echo "$${tag:-$$head}\c")
|
||||
COMPILE_DOCS = bin/elixir ../ex_doc/bin/ex_doc "$(1)" "$(VERSION)" "lib/$(2)/ebin" -m "$(3)" -u "https://github.com/elixir-lang/elixir" --source-ref "$(call SOURCE_REF)" -o doc/$(2) -p http://elixir-lang.org/docs.html
|
||||
LOGO_PATH = $(shell test -f ../docs/logo.png && echo "--logo ../docs/logo.png")
|
||||
SOURCE_REF = $(shell tag="$(call GIT_TAG)" revision="$(call GIT_REVISION)"; echo "$${tag:-$$revision}\c")
|
||||
COMPILE_DOCS = bin/elixir ../ex_doc/bin/ex_doc "$(1)" "$(VERSION)" "lib/$(2)/ebin" -m "$(3)" -u "https://github.com/elixir-lang/elixir" --source-ref "v$(VERSION)" $(call LOGO_PATH) -o doc/$(2) -a http://elixir-lang.org/docs/$(CANONICAL)/$(2)/ -p http://elixir-lang.org/docs.html
|
||||
|
||||
docs: compile ../ex_doc/bin/ex_doc
|
||||
$(Q) rm -rf doc
|
||||
|
||||
@@ -1731,11 +1731,11 @@ defmodule Enum do
|
||||
[]
|
||||
end
|
||||
|
||||
def take(collection, count) when is_list(collection) and count > 0 do
|
||||
def take(collection, count) when is_list(collection) and is_integer(count) and count > 0 do
|
||||
do_take(collection, count)
|
||||
end
|
||||
|
||||
def take(collection, count) when count > 0 do
|
||||
def take(collection, count) when count > 0 and is_integer(count) do
|
||||
{_, {res, _}} =
|
||||
Enumerable.reduce(collection, {:cont, {[], count}}, fn(entry, {list, count}) ->
|
||||
case count do
|
||||
@@ -1747,7 +1747,7 @@ defmodule Enum do
|
||||
:lists.reverse(res)
|
||||
end
|
||||
|
||||
def take(collection, count) when count < 0 do
|
||||
def take(collection, count) when count < 0 and is_integer(count) do
|
||||
Stream.take(collection, count).({:cont, []}, &{:cont, [&1|&2]})
|
||||
|> elem(1) |> :lists.reverse
|
||||
end
|
||||
|
||||
@@ -518,11 +518,11 @@ defmodule Stream do
|
||||
@spec take(Enumerable.t, non_neg_integer) :: Enumerable.t
|
||||
def take(_enum, 0), do: %Stream{enum: []}
|
||||
|
||||
def take(enum, n) when n > 0 do
|
||||
def take(enum, n) when n > 0 and is_integer(n) do
|
||||
lazy enum, n, fn(f1) -> R.take(f1) end
|
||||
end
|
||||
|
||||
def take(enum, n) when n < 0 do
|
||||
def take(enum, n) when n < 0 and is_integer(n) do
|
||||
&do_take(enum, abs(n), &1, &2)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user