Replies: 1 comment 3 replies
|
I realise this is pinpointing on the example rather than the overall concept of compile time function arguments, but: Might there be a possibility for alternatives to e.g.: @guppy
def example() -> None:
qs = ...
x = 3.14159
while some_condition(qs):
float_tagged_result("thing", x, measure_reset(qs[0]))
x = sqrt(x)where it accepts an additional runtime value to help build the tag? (I chose a while loop because a for loop over a qubit array would be doable with array printing when it lands, but a nondeterministic number of prints would be harder) |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Guppy typically exists inside hosted Python. We have the
pyexpression to allow compile-time known values to be captured from the outer python scope. So for instance to generate a statically sized array:However, there are many cases where you want the guppy function to be python-parametric - an example being string formatting in
resulttags where I want to call a function with a specific thing to add to my static result tag.There are few ways to achieve this, but taking inspiration from Zig comptime I suggest compile-time-only arguments to functions would be a neat way.
So that example would look something like:
here any expression over comptime arguments can be evaluated as pure python
Open to alternatives on syntax for this, e.g.:
All reactions