in python, there is
>>> a=[]
>>> a.append(a)
>>> a
[[...]]
how to implement this in elixir?
in python, there is
>>> a=[]
>>> a.append(a)
>>> a
[[...]]
how to implement this in elixir?
In Elixir this bug is fixed
feature? bug?
Can you show what you’re actually trying to do? If you want a collection that emits an infinite number of values there is Stream.repeatedly
. Beyond that, this feels like an X / Y problem.
def infinite(list \\ []) do
[infinite(list)]
end
infinite()
Just for fun. Didn’t test it. It will take infinite time before it returns. And I expect the output to be 42.
Closest thing I can think of would be a function that is infinitely callable, like this:
f = fn g -> fn -> g.(g) end end
h = f.(f)
h.().().().().().().().().()