DEV Community

Discussion on: Open Source Adventures: Episode 05: Sudoku Solver in Crystal Z3

Collapse
 
bcardiff profile image
Brian J. Cardiff

Lovely series! I have my own crystal-z3 which I am looking forward to mark it as archived if you want to maintain a shard for this!

Two things that I have in my mind regarding z3 in Crystal.

  1. Hopefully we can make the ideas of youtube.com/watch?v=rTOqg-f2rNM possible in Crystal. Having a solver assist the developer in program creating sounds sci-fi to me still.

  2. API related, Crystal does not allow overriding some binary operators || &&, cause they have typing implications. So there is a limit on how seamlessly the integration can look. But a possible way to solve this is via macros. Somthing like Z3.expr(a && b) could be a macro that translates Crystal syntax to Z3 api without needing && to be an actual call of the typeof(a). This might be useful for the previous point, since a and b could be either actual values or Z3 expressions depending on how the program is invoked.

Collapse
 
taw profile image
Tomasz Wegrzanowski

I've taken a look at your version, and wrote a post about how they compare.

Collapse
 
taw profile image
Tomasz Wegrzanowski

My Ruby Z3 gem uses | & and .ite for booleans as ||, &&, and ?: are not possible to override. I think I'll need to do the same in Crystal.