c4se記:さっちゃんですよ☆

.。oO(さっちゃんですよヾ(〃l _ l)ノ゙☆)

.。oO(此のblogは、主に音樂考察Programming に分類されますよ。ヾ(〃l _ l)ノ゙♬♪♡)

音樂は SoundCloud に公開中です。

考察は現在は主に Scrapbox で公表中です。

Programming は GitHub で開發中です。

A patch to run whatyouhide/stream_data in Elixir 1.4.* ヾ(〃l _ l)ノ゙

github.com

whatyouhide/stream_data は素晴らしい library だが Elixir 1.5 以上でなければ動かない。他の事の序でついでに 1.4 に對應させてみた。

diff --git a/lib/ex_unit_properties.ex b/lib/ex_unit_properties.ex
index f9822b1..f95bcad 100644
--- a/lib/ex_unit_properties.ex
+++ b/lib/ex_unit_properties.ex
@@ -373,7 +373,7 @@ defmodule ExUnitProperties do
         # TODO: Use :rand.export_seed in Elixir master.
         # The value may be :undefined in a new process
         # though, which means we may need to generate one.
-        initial_seed: {0, 0, ExUnit.configuration()[:seed]},
+        initial_seed: {0, 0, ExUnit.configuration()[:seed] || 1},
         initial_size:
           options[:initial_size] || Application.fetch_env!(:stream_data, :initial_size),
         max_runs: options[:max_runs] || Application.fetch_env!(:stream_data, :max_runs),
diff --git a/lib/stream_data.ex b/lib/stream_data.ex
index 6584798..ef4e673 100644
--- a/lib/stream_data.ex
+++ b/lib/stream_data.ex
@@ -513,7 +513,7 @@ defmodule StreamData do
     children =
       int
       |> Stream.unfold(next_division)
-      |> Stream.drop_while(&((int - &1) not in range))
+      |> Stream.drop_while(&(not (int - &1) in range))
       |> Stream.map(&integer_lazy_tree(int - &1, range))

     lazy_tree(int, children)
diff --git a/mix.exs b/mix.exs
index a658b0c..1d19f65 100644
--- a/mix.exs
+++ b/mix.exs
@@ -8,7 +8,7 @@ defmodule StreamData.Mixfile do
     [
       app: :stream_data,
       version: @version,
-      elixir: "~> 1.5",
+      elixir: "~> 1.4",
       start_permanent: Mix.env() == :prod,
       deps: deps(),

diff --git a/test/ex_unit_properties_test.exs b/test/ex_unit_properties_test.exs
index 8bc162d..3fd66a6 100644
--- a/test/ex_unit_properties_test.exs
+++ b/test/ex_unit_properties_test.exs
@@ -83,7 +83,7 @@ defmodule ExUnitPropertiesTest do
     property "shrinking" do
       assert_raise ExUnit.AssertionError, fn ->
         check all list <- list_of(integer()) do
-          assert 5 not in list
+          refute 5 in list
         end
       end
     end

が、私が作ってる library の 1.4 對應は切らうと思ふ。

Drop Elixir 1.4.* support · ne-sachirou/inner_cotton@63ce4f5

ヾ(〃l _ l)ノ゙