zxcalc / quantomatic

Quantomatic is a tool for doing automated graph rewriting.
http://quantomatic.github.io
152 stars 22 forks source link

Expose logging to the Simproc API #196

Closed hmillerbakewell closed 6 years ago

hmillerbakewell commented 6 years ago

We have a user messages system that creates logs - it would be useful to expose this to the Simproc API for better feedback.

hmillerbakewell commented 6 years ago

We should also make the messages more obvious

hmillerbakewell commented 6 years ago

Done with the LOG simproc - takes a python function of the form (graph => string)

Made as a simproc so can be chained etc.

For example:

def print_num_vert(g):
  return "Currently there are " + str(len(verts(g))) + " vertices."

register_simproc("basic-simp", REDUCE(simps) >> LOG(print_num_vert))