On Friday, 26 April 2024 at 13:25:34 UTC, Salih Dincer wrote:
You have a 5-item data tuples as Tuple(1, 2, 3, [1, 3], 5) and
implement the sum (total = 15) with the least codes using the
sum() function of the language you are coding...
Nim:
```nim
import std/[math, typetraits, macros]
macro
On Monday, 6 May 2024 at 17:55:49 UTC, user1234 wrote:
I think this just works:
```d
enum Flag : bool
{
no,
yes
}
alias AllowVancancy = Flag; // example usage
```
```d
import std.stdio : writeln;
enum Flag : bool { no, yes }
alias Traditional = Flag;
alias Color = Flag;
void hello(T
On Wednesday, 1 November 2023 at 16:24:04 UTC, BoQsc wrote:
**Error:**
```
rdmd testimport.d
testimport.d(2): Error: module `next` from file waffle\next.d
must be imported with 'import next;'
```
You import 'waffle.next', but the module is inferred to be
'next'. If put `module waffle.next;`
On Thursday, 2 November 2023 at 15:46:23 UTC, confuzzled wrote:
I've ported a small script from C to D. The original C version
takes roughly 6.5 minutes to parse a 12G file while the port
originally took about 48 minutes. My naïve attempt to improve
the situation pushed it over an hour and 15 m
On Saturday, 18 November 2023 at 07:47:19 UTC, BoQsc wrote:
`program("someProgramName").pipe("someOtherProgramName");`
Executes and pipes output to another program.
`program();` - Only executes the program.
Serious answer: have a function handle this, instead of the
semicolon.
`program("p1"
On Monday, 20 November 2023 at 16:09:33 UTC, Antonio wrote:
**Why this is a function and not a delegate?**
```auto createCounter = (int nextValue) => (int dummy) =>
nextValue++;```
Syntactically I dont see any difference:
`createCounter` is a function, and not a delegate, as it doesn't
clo
On Monday, 20 November 2023 at 23:50:24 UTC, Dmitry Ponyatov
wrote:
- not abandoned years ago
- documentation and commented samples presenets
- CTFE the best
https://code.dlang.org/packages/pegged
On Thursday, 23 November 2023 at 16:33:52 UTC, DLearner wrote:
Why is this so, bearing in mind the concatenations are executed
at
compile, not run, time?
If you compile without -betterC, it'll work, but if you examine
the result you'll find that the mxnTest function is still
compiled into th
On Thursday, 23 November 2023 at 17:46:55 UTC, DLearner wrote:
I just find it surprising that your suggestion worked, but the
(slightly simpler) earlier version did not.
The `enum` answer? That also works, but you have to make a change
at the callsite as well, to `mixin(mxnTest!("Var_A", "Var_
On Thursday, 23 November 2023 at 20:13:59 UTC, BoQsc wrote:
Nothing wrong. It would be just a more concise compact way to
do the same.
Also I mostly wanted to know if something like that is already
possible in D language.
It's not a huge loss if it is not possible.
This is possible in Go:
On Tuesday, 28 November 2023 at 08:51:21 UTC, Mark Davies wrote:
I did it this way ...
You always print the full array of bytes this way. Output piped
to `od -c` is
```
000 1 2 3 4 5 377 377 377 377 377 \n - 1 2
3 4
020 5 377 377 377 377 \n
```
Those 377s a
On Saturday, 2 December 2023 at 13:33:33 UTC, Johannes
Miesenhardt wrote:
I am a bloody beginner so if there are any things that are very
wrong with this please point them out.
The fact that I need a template for accepting both a string and
a char[] is very weird but I went with it. I am also cu
On Sunday, 3 December 2023 at 23:44:43 UTC, Julian Fondren wrote:
```d
if (str[i..$].startsWith(key)) return value;
```
Corrected. The other doesn't compile, unless you never run it
with -version=Part2 ...
On Monday, 4 December 2023 at 03:50:47 UTC, Siarhei Siamashka
wrote:
On Monday, 4 December 2023 at 03:07:07 UTC, matheus wrote:
import std.stdio;
import std.algorithm;
import std.array;
import std.format;
import std.conv;
import std.string;
...
Why do you do multiple imports instead of one imp
On Wednesday, 13 December 2023 at 20:40:20 UTC, monkyyy wrote:
so long term planning on wasm raylib; I want compatibility with
the good parts of the std, the std is causal about using libc
while ldc-wasm half-baked implication is missing a bunch of
basically worthless symbols but given the std
On Saturday, 16 December 2023 at 22:44:16 UTC, Dennis wrote:
That's because `m[f] = 1` initializes the associative array to
something non-null. If you pass a `null` AA to a function which
adds things, the caller will still have a null pointers.
I've gotten this error in deployed Perl. Whenever
On Sunday, 17 December 2023 at 00:10:56 UTC, Kevin Bailey wrote:
instead it seems like 'm' is a pointer to a std::map, that is
initialized on use if null. (I think it's that latter part that
gives the illusion of being already initialized.)
Yes:
https://dlang.org/spec/hash-map.html#constructi
On Thursday, 21 December 2023 at 22:19:07 UTC, Renato wrote:
LDC is slow and makes huge multi-MB binaries (is that normal?).
DMD seemed much better to me.
But at least LDC works :) so will use that for now.
On my setup ldc generates small binaries and dmd generates huge
ones. The difference
18 matches
Mail list logo