microsoft / qsharp

Azure Quantum Development Kit, including the Q# programming language, resource estimator, and Quantum Katas
https://microsoft.github.io/qsharp/
MIT License
397 stars 78 forks source link

BigInt ranges #491

Open bamarsha opened 1 year ago

bamarsha commented 1 year ago

From microsoft/qsharp-language#132:

I'd like to be able to write this:

for k in 0L..15L {
    ...
}

Currently this causes a compile error:

error QS0001: The type Int does not match the type BigInt

It should instead be equivalent to:

for k_helper in 0..15 {
    let k = IntAsBigInt(k_helper);
    ...
}
sezna commented 1 year ago

It could make sense to approach this issue by implementing generic UDTs, making ranges generic, and then re-implementing Int ranges, as well as BigInt ranges, in that new Range type.

nirajvenkat commented 3 months ago

Want to nudge this issue as it was mentioned in the call yesterday.