Twelve statements: Difference between revisions
Content added Content deleted
(Simpler D entry) |
(Simpler D entry) |
||
Line 180: | Line 180: | ||
=={{header|D}}== |
=={{header|D}}== |
||
{{trans|Python}} |
{{trans|Python}} |
||
<lang d>import std.stdio, std.typecons, std.algorithm, std.range, |
<lang d>import std.stdio, std.typecons, std.algorithm, std.range,std.functional; |
||
std.array, std.functional; |
|||
immutable texts = [ |
immutable texts = [ |
||
Line 212: | Line 211: | ||
s => sumi(s[6 .. 9]) == 1, |
s => sumi(s[6 .. 9]) == 1, |
||
s => sumi(s[0 .. 11]) == 4]; |
s => sumi(s[0 .. 11]) == 4]; |
||
void show(in bool[] st, in bool[] matches, in bool isPartial) { |
|||
if (isPartial) { |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
} |
|||
void main() { |
void main() { |
||
Line 245: | Line 232: | ||
foreach (sols, isPartial; zip([full, partial], [false, true])) |
foreach (sols, isPartial; zip([full, partial], [false, true])) |
||
foreach (stm; sols) |
foreach (stm; sols) { |
||
if (isPartial) { |
|||
⚫ | |||
⚫ | |||
pos + 1, texts[pos]); |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
} |
|||
}</lang> |
}</lang> |
||
{{out}} |
{{out}} |