Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions on arrays? #25

Open
swooboo opened this issue Jul 4, 2021 · 1 comment
Open

Functions on arrays? #25

swooboo opened this issue Jul 4, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@swooboo
Copy link

swooboo commented Jul 4, 2021

Amazing job guys. Any reason the first snippet can't be written as the second one?

1:

	for k in [0..n) { cand[k] := H(cand[k]);

2:

	cand := H(cand);

It's done in other languages like Python for example. Also your example for Grover's algorithm already does this in the circuit diagram! There's just one wire going into Hⁿ:

Grover's Algorithm from Silq website

So it would only be logical to implement in this language too, as Silq definitely attempts in giving a higher level of abstraction than building circuits and directly manipulating single bit registers. Again, great job on this, and I'll be eagerly waiting for when this language can export to some circuit format so we could play around with it on different systems, even maybe real ones.

@tgehr tgehr added the enhancement New feature or request label Aug 17, 2021
@tgehr
Copy link
Collaborator

tgehr commented Aug 17, 2021

I do agree that there should be some shorthand for this as it is very common. However, it is not fully clear to me what is the best way to do it.

Implicit mapping has some drawbacks, for example, it is ambiguous for some generic functions:

def twice[a:*](const x:a)⇒(x,x);

def main()⇒twice(1,2); // ((1,2),(1,2)) or ((1,1),(2,2))?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants