Hi Julia-ites. I’m the author of the Python package PyQuante, which is a quantum chemistry package written in Python. In order to better learn Julia, I spent a weekend a couple of years ago translating the core of the program into Julia. I just picked up the code again, and several pieces of it no longer work. The one I’m tripping over now is the code I wrote to iterate over pairs of indices:
function pairs2(n::Int64)
function _it()
for i in 1:n
for j in 1:i
produce((i,j))
end
end
end
Task(_it)
end
My intention was to make this roughly equivalent to the python itertools.combinations(range(n),2).
Or even
def pairs2(n):
for i in range(n):
for j in range(i):
yield i,j
The problem with writing a whole lot of code in a single weekend using a new language is that one doesn’t remember exactly one did things. I can’t remember why the Task command was necessary, but my vague recollection was that it turned the _it() function into an iterator.
In any case, I now get come confusing command that I should be using Channels for interprocess communications, which makes me suspect that Task() was the wrong thing to use in the first place.
Can anyone help me out? Thanks in advance,
Rick