On Wednesday, 9 February 2022 at 16:37:22 UTC, Ali Çehreli wrote:
On 2/9/22 01:07, bauss wrote:
> It will not run at compile-time because csvText is a runtime
variable.
> It should be enum to be accessible at compile-time.
Yes. For the sake of completeness, any expression needed at
compile
On Thursday, 10 February 2022 at 01:43:54 UTC, H. S. Teoh wrote:
On Thu, Feb 10, 2022 at 01:32:00AM +, MichaelBi via
Digitalmars-d-learn wrote:
On Wednesday, 9 February 2022 at 19:48:49 UTC, H. S. Teoh
wrote:
> [...]
thanks, very helpful! i am using a assocArray now...
Are you sure
On Thu, Feb 10, 2022 at 01:32:00AM +, MichaelBi via Digitalmars-d-learn
wrote:
> On Wednesday, 9 February 2022 at 19:48:49 UTC, H. S. Teoh wrote:
> > [...]
>
> thanks, very helpful! i am using a assocArray now...
Are you sure that's what you need?
T
--
Computers are like a jungle: they
On Wednesday, 9 February 2022 at 19:48:49 UTC, H. S. Teoh wrote:
[...]
thanks, very helpful! i am using a assocArray now...
On Thu, Feb 10, 2022 at 12:53:08AM +, Siarhei Siamashka via
Digitalmars-d-learn wrote:
> On Wednesday, 9 February 2022 at 21:05:47 UTC, Siarhei Siamashka wrote:
> > Is the current implementation of associative arrays in D language
> > resistant to Denial of Service hash collision attacks?
>
On Wednesday, 9 February 2022 at 21:05:47 UTC, Siarhei Siamashka
wrote:
Is the current implementation of associative arrays in D
language resistant to Denial of Service hash collision attacks?
Answering to myself. No, it isn't. Here's a simple example:
```D
import std, core.time;
const ulong
On Tuesday, 8 February 2022 at 21:42:06 UTC, H. S. Teoh wrote:
But as I said, this is overkill for something so trivial. Using
`bool[E]` or an RBTree works just fine.
Is the current implementation of associative arrays in D language
resistant to Denial of Service hash collision attacks?
*
On Wed, Feb 09, 2022 at 11:05:23AM -0800, Ali Çehreli via Digitalmars-d-learn
wrote:
> On 2/9/22 10:38, MoonlightSentinel wrote:
>
> > There's a way to use a much smaller array to manage the lanternfish
> > population...
>
> As soon as I read your comment, I was reminded of a certain ingenious
On 2/9/22 10:38, MoonlightSentinel wrote:
> There's a way to use a much smaller array to manage the lanternfish
> population...
As soon as I read your comment, I was reminded of a certain ingenious
sorting algorithm that is O(N). ;) After reading the problem
description, I see your hint was
On Wednesday, 9 February 2022 at 10:03:21 UTC, MichaelBi wrote:
day6 of the advent of code 2021 needs to handle an array of
10^12 length, or even bigger...
As others have mentioned, huge arrays require appropriate memory
/ the use of memory-mapped files to actually store it. But the
On 2/9/22 08:37, Ali Çehreli wrote:
> In any case, some people may find a compile-time file parsing example
> that I included in a presentation:
That should mean "may find interesting". And I've just realized that the
chapter link is off in that video. This is the beginning of that section:
On 2/9/22 01:07, bauss wrote:
> It will not run at compile-time because csvText is a runtime variable.
> It should be enum to be accessible at compile-time.
Yes. For the sake of completeness, any expression needed at compile time
will be (attempted to be) executed at compile time. For example,
On Wednesday, 9 February 2022 at 10:25:34 UTC, bauss wrote:
Is it guaranteed that the value is initialized at compiletime
however?
yes, D guarentees this at 100%.
On Wednesday, 9 February 2022 at 10:01:15 UTC, Anonymouse wrote:
On Wednesday, 9 February 2022 at 08:12:52 UTC, Vindex wrote:
[...]
I would do this.
```
import std;
alias Record = Tuple!(string, string, string);
static immutable string[][] table = () {
string[][] table;
string
On Wednesday, 9 February 2022 at 10:29:03 UTC, ag0aep6g wrote:
Try to think of a more efficient way of storing the information.
I cant agree more. The problem of OP is not dynamic arrays, it's
that he uses an inadequate data structure.
On Wednesday, 9 February 2022 at 10:03:21 UTC, MichaelBi wrote:
day6 of the advent of code 2021 needs to handle an array of
10^12 length, or even bigger... plus change elements and append
elements. normal implementation such as length, appender and
ref element etc, seems cannot handle that big
On 09.02.22 11:09, MichaelBi wrote:
On Wednesday, 9 February 2022 at 10:05:23 UTC, MichaelBi wrote:
[...]
got outofmemory error:
core.exception.OutOfMemoryError@src\core\lifetime.d(126): Memory
allocation failed
https://adventofcode.com/2021/day/6#part2
"Suppose the lanternfish live
On Wednesday, 9 February 2022 at 10:01:15 UTC, Anonymouse wrote:
On Wednesday, 9 February 2022 at 08:12:52 UTC, Vindex wrote:
Will the loop (foreach) run at compile time? How can I make it
work at compile time?
```
import std.csv, std.stdio;
alias Record = Tuple!(string, string, string);
On Wednesday, 9 February 2022 at 10:03:21 UTC, MichaelBi wrote:
day6 of the advent of code 2021 needs to handle an array of
10^12 length, or even bigger... plus change elements and append
elements. normal implementation such as length, appender and
ref element etc, seems cannot handle that big
On Wednesday, 9 February 2022 at 10:05:23 UTC, MichaelBi wrote:
On Wednesday, 9 February 2022 at 10:03:21 UTC, MichaelBi wrote:
day6 of the advent of code 2021 needs to handle an array of
10^12 length, or even bigger... plus change elements and
append elements. normal implementation such as
On Wednesday, 9 February 2022 at 08:12:52 UTC, Vindex wrote:
Will the loop (foreach) run at compile time? How can I make it
work at compile time?
```
import std.csv, std.stdio;
alias Record = Tuple!(string, string, string);
immutable string[][] table;
shared static this() {
string
day6 of the advent of code 2021 needs to handle an array of 10^12
length, or even bigger... plus change elements and append
elements. normal implementation such as length, appender and ref
element etc, seems cannot handle that big array? is there any
alternative data structure or algorithm can
On Wednesday, 9 February 2022 at 08:12:52 UTC, Vindex wrote:
Will the loop (foreach) run at compile time? How can I make it
work at compile time?
```
import std.csv, std.stdio;
alias Record = Tuple!(string, string, string);
immutable string[][] table;
shared static this() {
string
On Tuesday, 8 February 2022 at 20:15:50 UTC, forkit wrote:
btw. the key is listed there - not sure what you mean.
I didn't see "3AAF1A18E61F6FAA3B7193E4DB8C5218B9329CF8" on the
listing on the webpage https://dlang.org/gpg_keys.html
That pages is not similar to what I get with "--list-keys
Will the loop (foreach) run at compile time? How can I make it
work at compile time?
```
import std.csv, std.stdio;
alias Record = Tuple!(string, string, string);
immutable string[][] table;
shared static this() {
string csvText = import("file.csv");
foreach (record;
25 matches
Mail list logo