Skip to main content
4 of 5
Added nomination
DLosc
  • 40.7k
  • 34
  • 49

Best Tip

Repost from 2020

For the best answer to a question tagged with , because this site isn't just about competing with one another, but also about helping each other improve our golfing skills

The shortest infinite for comprehension (self-nomination by pxeger)

While answering Write an infinitely nested generator comprehension, I discovered a way to shorten something you might think to be totally optimal, which felt like a crazy new discovery to make.

s isn't longest first, but is by Unrelated String

In Brachylog, s is the obvious builtin for "get all contiguous sublists." The trouble is that you often want to generate the longest sublist first, and s doesn't do that: it starts with all sublists that include the first element. However, Unrelated String realized that , "get all sublists, not necessarily contiguous," does generate the longest sublists first, and furthermore that the non-contiguous results can be easily removed by combining with s. This tip is non-obvious and really useful; I've used it twice already.

Wheat Wizard Mod
  • 102.9k
  • 1
  • 42
  • 88