You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(mate/dreduce + [1 3 5 7 9]) (as an example) will print all the stages to stdout.
Problem
Printing is time consuming
The developer writes the code especially for debugging
Need to change the code for production in order not to have the time consuming printing
Suggested Solution
What if the developer will not have to change the production code and in the same time will not suffer from printing? Sounds good to be true? Sounds like conditional printing!
The whole idea is that during runtime we can decide whether or not to print. I suggest 3 methods to do that:
Printing Levels:
Every macro can take an optional printing level ∈ #{0 1 2 3 4 5}. This level must be >= mate/*min-level* for printing to occur.
For example:
(mate/dreduce {:level3} + [13579]) ; Only activates printing when (>= 3 *min-level*)
A developer can setmate/min-level by mate/set-min-level!
Namaspace Filtering:
Prints can be elided or filtered by the namespace in which they occur.
For example, a developer can call
Hi! I suggest a new idea, conditional printing.
Current state
(mate/dreduce + [1 3 5 7 9])
(as an example) will print all the stages to stdout.Problem
Suggested Solution
What if the developer will not have to change the production code and in the same time will not suffer from printing? Sounds good to be true? Sounds like conditional printing!
The whole idea is that during runtime we can decide whether or not to print. I suggest 3 methods to do that:
Every macro can take an optional printing level ∈ #{0 1 2 3 4 5}. This level must be >=
mate/*min-level*
for printing to occur.For example:
A developer can set
mate/min-level
bymate/set-min-level!
Prints can be elided or filtered by the namespace in which they occur.
For example, a developer can call
Each macro supports an optional arbitrary test expression:
That's it, thanks :)
This idea and suggested solution was inspired by tufte profiler
The text was updated successfully, but these errors were encountered: