small medium large xlarge

Go_stones_bigger_pragsmall
24 Aug 2013, 04:08
James Ludlow (7 posts)
  • PDF version: b6_0_10_1
  • Page: 85
  • Elixir version: 0.10.2-dev

When I try to run the example for “repeatedly” I get this:

iex(1)> Stream.repeatedly(function(:random.uniform/0)) |> Enum.take(3)
** (ArithmeticError) bad argument in arithmetic expression
:erlang./(0.4435846174457203, 0)

If I change it slightly, it works.

iex(1)> Stream.repeatedly(&:random.uniform/0) |> Enum.take(3)         
[0.7230402056221108, 0.94581636451987, 0.5014907142064751]
You must be logged in to comment