Open gbotrel opened 3 years ago
Recently wants to use it, could you give some ideas about how to add if
in circuit?
hi @SherLzp --> there is a branch, a bit outdated to explore some ideas: https://github.com/ConsenSys/gnark/tree/feat/conditional
this is going to get some attention quite soon, but first we have some PlonK efficiency work on the plate.
Noted. Thanks
When will this issue be implemented? @gbotrel
In an imperative programming language, that would be a
if
/else
.However, it doesn't translate well in a declarative API to define the circuit, as the output of the
frontend.Compile
method is an arithmetic representation that must encode the various branches.gnark
offerscs.Select(...)
API, which is similar to Prolog-like languages.At a minimum,
gnark
should provide some syntactic sugar to wrap several instructions, maybe in a lambda, into a aif
-like statement.