On Saturday, 23 July 2022 at 22:50:55 UTC, Salih Dincer wrote:
**My code outputs:**
```
[0, 0, 0, 0, 0, 0, 0, 0]: 1
[0, 0, 0, 0, 0, 0, 0, 1]: 2
[0, 0, 0, 0, 0, 0, 1, 0]: 3
[0, 0, 0, 0, 0, 0, 2, 1]: 4
[0, 0, 0, 0, 0, 1, 1, 0]: 5
[0, 0, 0, 0, 0, 2, 0, 1]: 6
[0, 0, 0, 0, 0, 2, 1, 0]: 7
[0, 0, 0, 0,
On Saturday, 23 July 2022 at 19:50:51 UTC, Test123 wrote:
I has this function, it print all possible combinations.
```d
void doRepetition(const int n, const int m){
// combination total number is m, element is repeatable.
// ...
}
```
`doRepetition(4, 3);` will print
0 0
0 1
0 2
1 1
1
On Saturday, 23 July 2022 at 20:00:06 UTC, rikki cattermole wrote:
A bit more d-ified and uses foreach + foreach_reverse without
allocating an array.
[...]
Your give the correct code, but wrong Output.
Thanks again for the help.
On Saturday, 23 July 2022 at 20:00:06 UTC, rikki cattermole wrote:
A bit more d-ified and uses foreach + foreach_reverse without
allocating an array.
[...]
Thanks for the quick reply.
I also get your results, it is not correct because the secends
number is not matched.
Not I look at you
A bit more d-ified and uses foreach + foreach_reverse without allocating
an array.
```d
import std.stdio;
void main()
{
doRepetition(4, 3);
writeln("==");
doRepetitionReversed(4, 3);
}
void doRepetition(const int n, const int m)
{
// combination total number is m, elem
On Saturday, 23 July 2022 at 19:50:51 UTC, Test123 wrote:
I has this function, it print all possible combinations.
```d
void doRepetition(const int n, const int m){
// combination total number is m, element is repeatable.
assert(n >= 1 && n < 10);
assert(m >= 1 && m < 10);
enum
I has this function, it print all possible combinations.
```d
void doRepetition(const int n, const int m){
// combination total number is m, element is repeatable.
assert(n >= 1 && n < 10);
assert(m >= 1 && m < 10);
enum N = 10;
ubyte[10] a;
void inc(int index, int r, int
On Saturday, 23 July 2022 at 00:56:39 UTC, Steven Schveighoffer
wrote:
On 7/22/22 3:22 PM, Azi Hassan wrote:
Oh, interesting syntax. I was thinking something along the
lines of
```D
template printEnum(...) {
version(debug) {
... // everything we already did
} else {
On Saturday, 23 July 2022 at 08:32:12 UTC, Ola Fosheim Grøstad
wrote:
Also `char*` can't work as char cannot contain pointers. I
guess you would need to use `void*`.
Well, that is wrong for the standard collection where the typing
is dynamic (based on allocation not on type system). Then any
On Saturday, 23 July 2022 at 00:55:14 UTC, Steven Schveighoffer
wrote:
Probably. Though like I said, I doubt it matters. Maybe someone
with more type theory or GC knowledge knows whether it should
be OK or not.
Has nothing to do with type theory, only about GC implementation.
But his object h
10 matches
Mail list logo