You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [1]: def f():
...: yield f()
In [2]: next(f())
Out[2]: <generator object f at 0x1427640>
In [3]: next(next(f()))
Out[3]: <generator object f at 0x1427730>
I'm not really sure that i wrote it right:
julia> function test()
produce(test())
end
julia> t = Task(test)
Task
julia> consume(t)
And got this:
julia(90886,0x7fff73df5960) malloc: *** mmap(size=140730481774592) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
julia(90886,0x7fff73df5960) malloc: *** mmap(size=140730481782784) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
julia(90886,0x7fff73df5960) malloc: *** mmap(size=140730481790976) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
^C^C^C
[1] 90886 segmentation fault ./julia
Version 0.0.0+100556114.r27bb
The text was updated successfully, but these errors were encountered:
In python, any function that uses yield automatically returns a generator.
In julia, you always have to wrap the function into a Task manually, so your code should be
function test()
produce(Task(test))
end
which works for me.
The function
function test()
produce(test())
end
evaluates itself in an infinite recursion trying to produce a value to give to produce, so it should give a stack overflow error, and it does if I call it as test(). I can confirm that your code gives a segfault for me too, so yes, this must be a bug.
Hi, I tried to reproduce python code in julia
I'm not really sure that i wrote it right:
And got this:
Version 0.0.0+100556114.r27bb
The text was updated successfully, but these errors were encountered: