gnark
gnark copied to clipboard
feat: add format specifiers for `api.Println` or implement `api.Printf`
To be precise, I think you can add a func like api.Printf("this is my var %fv. ", circuit.x), and hope it have the same performance with fmt.Printf()
func (circuit *Circuit) Define(api frontend.API) error{
api.Printf("this is my var %fv. ", circuit.x)
}
go
cmd output: this is my var 2
It could be useful - I think we could have different formatting options:
- hex
- int
- small integer - if value is small when considered as a negative, then print that instead
- coefficient ID
- variable ID
@ivokub In addition to api.Println(), it's possible to provide a new API api.Fmt() that feeds the printing content to a string?
It is possible, but we currently don't have it on the roadmap. I think it could be a suitable task for external contribution though.