Comment by vidarh

8 hours ago

I also found it mindbending.

But some parts, like e.g. the cut operator is something I've copied several times over for various things. A couple of prototype parser generators for example - allowing backtracking, but using a cut to indicate when backtracking is an error can be quite helpful.

"Keep your exclamation points under control. You are allowed no more than two or three per 100,000 words of prose."

Elmore Leonard, on writing. But he might as well have been talking about the cut operator.

At uni I had assignments where we were simply not allowed to use it.

  • I used to use a cut operator about every 2 to 4 rules. If you are constantly using it as error handling, I would agree you are using it too often. If you are using it to turn sets into scalars or cells, then you are using it correctly. It just makes the code really hard to reason about and maintain.