Self-describing numbers: Difference between revisions
m
→Alternative With "Optimisations": update @truncate() call
Recombinant (talk | contribs) |
Recombinant (talk | contribs) m (→Alternative With "Optimisations": update @truncate() call) |
||
Line 3,593:
3211000
42101000</pre>
===Alternative With "
Here is an alternative implementation of <em>isSelfDescribing()</em> that
illustrates additional computationally cheap ways of partially eliminating
Line 3,637:
// should equal the number of digits in the number
var sum: u32 = 0;
for (digits, 0..) |n, index| sum += n * @
if (sum != digits.len) return false;
}
|