On Saturday, 22 January 2022 at 01:33:16 UTC, Steven
Schveighoffer wrote:
so I why watching this video by Andrei:
https://www.youtube.com/watch?v=mCrVYYlFTrA
In it, he talked about writing the simplest design that could
possibly work
Which got me thinking
//
module test;
On 1/21/22 6:24 PM, forkit wrote:
On Friday, 21 January 2022 at 22:25:32 UTC, forkit wrote:
I really like how alias and mixin can simplify my code even further:
//---
int[][int][] CreateDataSet
(const(int) recordsNeeded, const(int) valuesPerRecord)
{
int[][int][] records;
On Friday, 21 January 2022 at 22:25:32 UTC, forkit wrote:
I really like how alias and mixin can simplify my code even
further:
//---
int[][int][] CreateDataSet
(const(int) recordsNeeded, const(int) valuesPerRecord)
{
int[][int][] records;
records.reserve(recordsNeeded);
const
On Friday, 21 January 2022 at 21:56:33 UTC, H. S. Teoh wrote:
What's the point of calling .dup here? The only reference to
records is going out of scope, so why can't you just return it?
The .dup is just creating extra work for nothing.
T
good pickup. thanks ;-)
//
module test;
On Fri, Jan 21, 2022 at 09:43:38PM +, forkit via Digitalmars-d-learn wrote:
> On Friday, 21 January 2022 at 21:01:11 UTC, forkit wrote:
[...]
> even better, I got rid of all those uncessary arrays ;-)
>
> // ---
>
> int[][int][] CreateDataSet
> (const(int) recordsNeeded,
On Friday, 21 January 2022 at 21:43:38 UTC, forkit wrote:
oops... should be:
// ---
int[][int][] CreateDataSet
(const(int) recordsNeeded, const(int)valuesPerRecord)
{
int[][int][] records;
records.reserve(recordsNeeded);
const int iotaStartNum = 100_000_001;
foreach(i, id;
On Friday, 21 January 2022 at 21:01:11 UTC, forkit wrote:
even better, I got rid of all those uncessary arrays ;-)
// ---
int[][int][] CreateDataSet
(const(int) recordsNeeded, const(int)valuesPerRecord)
{
int[][int][] records;
records.reserve(recordsNeeded);
foreach(i, id;
> On Friday, 21 January 2022 at 17:25:20 UTC, Ali Çehreli wrote:
[...]
> > Additionally, just because we *provide* a step, now we *require*
> > division from all types (making it very cumbersome for user-defined
> > types).
[...]
It doesn't have to be this way. We could just use DbI to inspect
On Friday, 21 January 2022 at 18:50:46 UTC, Steven Schveighoffer
wrote:
Yeah, iota is a random-access range, so you can just pass it
directly, and not allocate anything.
Looking at the usage, it doesn't need to be an array at all.
But modifying the code to properly accept the range might
On Friday, 21 January 2022 at 18:36:42 UTC, H. S. Teoh wrote:
This is wasteful if you're not planning to use every ID in this
million-entry long array. Much better to just use an AA to
keep track of which IDs have already been generated instead.
Of course, if you plan to use most of the
On Friday, 21 January 2022 at 17:25:20 UTC, Ali Çehreli wrote:
Ouch! I tried the following code, my laptop got very hot, it's
been centuries, and it's still running! :p
:)
```d
size_t length() inout {
auto len = 1 + (last - first) / step;
return cast(size_t)len;
}
```
Does
On 1/21/22 1:36 PM, H. S. Teoh wrote:
On Fri, Jan 21, 2022 at 10:12:42AM +, forkit via Digitalmars-d-learn wrote:
[...]
// id needs to be 9 digits, and needs to start with 999
int[] idArray = takeExactly(iota(999*10^^6, 10^^9),
recordsNeeded).array;
[...]
This is wasteful if
On Fri, Jan 21, 2022 at 10:12:42AM +, forkit via Digitalmars-d-learn wrote:
[...]
> Random rnd;
> static this() { rnd = Random(unpredictableSeed); } // thanks Ali
Actually you don't even need to do this, unless you want precise control
over the initialization of your RNG. If you don't
On Fri, Jan 21, 2022 at 09:10:56AM +, forkit via Digitalmars-d-learn wrote:
[...]
> turns out the problem has nothing to do with appender...
>
> It's actually this line:
>
> if (!idArray.canFind(x)):
>
> when i comment this out in the function below, the program does what I
> want in
On 1/21/22 08:58, Salih Dincer wrote:
> ```d
> auto inclusiveRange(T)(T f, T l, T s = cast(T)0)
> in(!isBoolean!T) {
'in' contracts are checked at runtime. The one above does not make sense
because you already disallow compilation for 'bool' below.
You could add a template constraint there:
On Thursday, 20 January 2022 at 16:33:20 UTC, Ali Çehreli wrote:
So if we add the 1.0 value after 0.900357627869 to be
*inclusive*, then that last step would not be 0.3 anymore.
(Thinking about it, step would mess up things for integral
types as well; so, it must be checked during
On Friday, 21 January 2022 at 09:10:56 UTC, forkit wrote:
ok... in the interest of corecting the code I posted previously...
... here is a version that actually works in secs (for a million
records), as opposed to hours!
// ---
/+
On Friday, 21 January 2022 at 09:52:10 UTC, Jerry wrote:
On Thursday, 20 January 2022 at 19:31:06 UTC, H. S. Teoh wrote:
T
Found ld linker as you described.
Slapped on the --linker=ld flag and now everything is working.
Thanks! :D
Or atleast that's what I thought, it links, but won't run,
On Thursday, 20 January 2022 at 19:31:06 UTC, H. S. Teoh wrote:
T
Found ld linker as you described.
Slapped on the --linker=ld flag and now everything is working.
Thanks! :D
On Thursday, 20 January 2022 at 19:31:06 UTC, H. S. Teoh wrote:
On Thu, Jan 20, 2022 at 07:10:40PM +, Jerry via
Digitalmars-d-learn wrote:
You're trying to use bfd as your linker, and I think that only
exists on the Linux version of the NDK. Maybe try looking
somewhere under
On Friday, 21 January 2022 at 08:53:26 UTC, Stanislav Blinov
wrote:
turns out the problem has nothing to do with appender...
It's actually this line:
if (!idArray.canFind(x)):
when i comment this out in the function below, the program does
what I want in seconds.
only problem is, the
On Thursday, 20 January 2022 at 19:31:06 UTC, H. S. Teoh wrote:
I'm not sure how it works on Windows, but there should be
corresponding binaries that might give a hint as to what's the
correct -fuse-ld=... option you need to use.
Here I documented some of the quirks I've hit during android
On Friday, 21 January 2022 at 03:50:37 UTC, forkit wrote:
I might have to use a kindof stringbuilder instead, then write
a massive string once to the file.
You're using writeln, which goes through C I/O buffered writes.
Whether you make one call or several is of little consequence -
you're
23 matches
Mail list logo