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

feat: add format specifiers for api.Println or implement api.Printf #1239

Open
George551556 opened this issue Aug 7, 2024 · 3 comments
Open
Labels

Comments

@George551556
Copy link

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
@ivokub ivokub added new feature good first issue Good for newcomers labels Aug 7, 2024
@ivokub
Copy link
Collaborator

ivokub commented Aug 7, 2024

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

@zliucd
Copy link

zliucd commented Sep 2, 2024

@ivokub In addition to api.Println(), it's possible to provide a new API api.Fmt() that feeds the printing content to a string?

@ivokub
Copy link
Collaborator

ivokub commented Sep 3, 2024

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.

@ivokub ivokub changed the title Improve the use of "api.Println()". feat: add format specifiers for api.Println or implement api.Printf Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants