Elektrine lite

← Feed

@slava@mathstodon.xyz

Post #4332498

2026-08-01 09:56 UTC

@simontatham@hachyderm.io “the only sensible thing to do is write a recursive function, containing _one_ of those for loops; give it a parameter to control the recursion depth, and at the deepest level it calls f with the list it built up.” An n-tuple with elements drawn from a finite set of k elements is just a base-k integer with n digits, isn’t it? So an easy way to generate all such n-tuples is to start with the first such tuple and repeatedly increment it by one until you carry the last digit. Seems a bit simpler than recursion

Replies (0)

No replies.