[julia-users] Re: Using generators

2016-10-03 Thread harven
Thanks for the answers, the examples are enlightening. I thought at first that a generator could be used whenever an array was expected, I get it now.

Re: [julia-users] Re: Using generators

2016-10-03 Thread Stefan Karpinski
There's nothing you can do with comprehensions or generators that you can't do with for loops or functional programming. But there are situations where they are considerably more convenient syntactically. Consider a case where you have several nested for clauses and a filter clause involving all of

[julia-users] Re: Using generators

2016-10-02 Thread Steven G. Johnson
On Sunday, October 2, 2016 at 6:02:13 AM UTC-4, harven wrote: > > I see that julia v0.5 has now generators. That looks promising but the > example given in the docs is not really interesting, > > sum(1/n^2 for n = 1:1000) > > since we have been able to write from start the shorter and