Hi, I need help again. I have an immutable static array and i
need to initialize its contents inside a for loop. Something like
this:
void f(int n)()
{
immutable float[n] my_array;
for(int i=0;i
On Tuesday, 18 July 2017 at 07:20:48 UTC, Miguel L wrote:
Hi, I need help again. I have an immutable static array and i
need to initialize its contents inside a for loop. Something
like this:
void f(int n)()
{
immutable float[n] my_array;
for(int i=0;i
I'd probably separate the calculati
On Tuesday, 18 July 2017 at 07:30:30 UTC, Era Scarecrow wrote:
my_array[i]=some calculations(based on constants and n)
i meant: tmp[i]=some calculations(based on constants and n)
On Tuesday, 18 July 2017 at 07:31:22 UTC, Era Scarecrow wrote:
On Tuesday, 18 July 2017 at 07:30:30 UTC, Era Scarecrow wrote:
my_array[i]=some calculations(based on constants and n)
i meant: tmp[i]=some calculations(based on constants and n)
That does work, thanks.
On 2017-07-17 22:11, Nordlöw wrote:
- under what name: append, concat or cat?
append - add array or element to existing array
concat (concatenate) - add to arrays (or element) together to create a
new array
Seems like this is a concatenation. But please avoid shortening the
names. I vote y
On Tuesday, 18 July 2017 at 03:36:04 UTC, Nicholas Wilson wrote:
With regards to parallel, only use it on the outermost loop.
Assuming you have more items in the outermost loop than you do
threads parallelising more than one loop won't net you any
speed.
Thank you! Yes, `parallel` runs only 4
On Monday, 17 July 2017 at 17:38:23 UTC, Nordlöw wrote:
I'm want to define a specialization of `append()` that takes
only static arrays as inputs and returns a static array being
the sum of the lengths of the inputs.
Have anybody already implemented this?
If not, I'm specifically interested i
class OpCode
{
private:
byte[] bytes_;
public:
void opCall(Program program) const;
byte[] bytes() const {
return bytes_.dup;
}
}
class AddD : OpCode
{
private:
uint d, s;
public:
this(uint dst, uint src) {
d = ds
On Tuesday, 18 July 2017 at 11:06:22 UTC, Enjoys Math wrote:
class OpCode
{
private:
byte[] bytes_;
public:
void opCall(Program program) const;
byte[] bytes() const {
return bytes_.dup;
}
}
class AddD : OpCode
{
private:
uint d, s;
pub
On Tuesday, 18 July 2017 at 11:06:22 UTC, Enjoys Math wrote:
[ ... ]
The cast at the bottom gives a compiler error (can't cast
byte[] to double).
If you want to see how it's done check:
https://github.com/UplinkCoder/dmd/blob/newCTFE_on_master/src/ddmd/ctfe/bc.d
Though if you have the choice
On Tuesday, 18 July 2017 at 08:07:45 UTC, Jacob Carlborg wrote:
append - add array or element to existing array
concat (concatenate) - add to arrays (or element) together to
create a new array
Seems like this is a concatenation. But please avoid shortening
the names. I vote you go with "conca
On Tuesday, 18 July 2017 at 08:46:50 UTC, Jack Applegame wrote:
On Monday, 17 July 2017 at 17:38:23 UTC, Nordlöw wrote:
I'm want to define a specialization of `append()` that takes
only static arrays as inputs and returns a static array being
the sum of the lengths of the inputs.
Have anybody
There is a way to get the full function(or any other structure)
declaration with traits? Or I will have to mount it with
std.traits functions?
eg.
void add(int x, int y){}
GetFullFunctionDeclaration!add; //return "void add(int x, int y)"
import std.stdio, std.datetime, std.conv, std.algorithm;
void main()
{
immutable DEADLINE = DateTime(2017, 7, 16, 23, 59,
59).to!SysTime;
immutable NOW = Clock.currTime;
immutable INTERVAL = (DEADLINE - NOW)
.abs
.to!string;
On Tuesday, 18 July 2017 at 13:35:49 UTC, SrMordred wrote:
There is a way to get the full function(or any other structure)
declaration with traits? Or I will have to mount it with
std.traits functions?
eg.
void add(int x, int y){}
GetFullFunctionDeclaration!add; //return "void add(int x, int
On Tuesday, 18 July 2017 at 13:53:11 UTC, Ivan Kazmenko wrote:
On Tuesday, 18 July 2017 at 13:35:49 UTC, SrMordred wrote:
There is a way to get the full function(or any other
structure) declaration with traits? Or I will have to mount it
with std.traits functions?
eg.
void add(int x, int y){}
On Tue, 2017-07-18 at 03:36 +, Nicholas Wilson via Digitalmars-d-learn
wrote:
> On Monday, 17 July 2017 at 11:07:35 UTC, Anton Fediushin wrote:
> > […]
> >
> > Also, I have a question about running this in parallel: if I
> > want to use nested loops with `parallel` from
> > `std.parallelism`
On Tue, 2017-07-18 at 08:41 +, Anton Fediushin via Digitalmars-d-learn
wrote:
> On Tuesday, 18 July 2017 at 03:36:04 UTC, Nicholas Wilson wrote:
> > With regards to parallel, only use it on the outermost loop.
> > Assuming you have more items in the outermost loop than you do
> > threads para
Hi all,
I'm trying dmd-2.075.0-rc1 in one of my projects where I use
`squeeze` and `removechars`. Both of them are flagged as obsolete
and in the docs we are suggested to use functions from std.regex
and/or std.algorithm.
Does any one kow a one-liner from std.regex or std.algorithm that
can
On Tuesday, 18 July 2017 at 15:28:06 UTC, Antonio Corbi wrote:
Hi all,
I'm trying dmd-2.075.0-rc1 in one of my projects where I use
`squeeze` and `removechars`. Both of them are flagged as
obsolete and in the docs we are suggested to use functions from
std.regex and/or std.algorithm.
Does a
On Tuesday, 18 July 2017 at 15:28:06 UTC, Antonio Corbi wrote:
Hi all,
I'm trying dmd-2.075.0-rc1 in one of my projects where I use
`squeeze` and `removechars`. Both of them are flagged as
obsolete and in the docs we are suggested to use functions from
std.regex and/or std.algorithm.
Does a
On Tuesday, 18 July 2017 at 15:41:44 UTC, Meta wrote:
On Tuesday, 18 July 2017 at 15:28:06 UTC, Antonio Corbi wrote:
Hi all,
I'm trying dmd-2.075.0-rc1 in one of my projects where I use
`squeeze` and `removechars`. Both of them are flagged as
obsolete and in the docs we are suggested to use f
On Tuesday, 18 July 2017 at 15:41:44 UTC, Meta wrote:
As Seb somewhat undiplomatically put, there are replacements
listed in the changelog.
Sorry - it wasn't intended to be an offense or aggressive. I
consider(ed) RTFM as common internet slang.
On Tuesday, 18 July 2017 at 15:55:00 UTC, Seb wrote:
On Tuesday, 18 July 2017 at 15:41:44 UTC, Meta wrote:
As Seb somewhat undiplomatically put, there are replacements
listed in the changelog.
Sorry - it wasn't intended to be an offense or aggressive. I
consider(ed) RTFM as common internet sl
Maybe use a union?
union U {
double d;
byte[double.sizeof] bytes;
}
U u;
u.bytes = ...;
double d = u.d;
... // do something with d
// or:
U u;
u.d = 3.14159;
byte[] b = u.bytes[];
On Tuesday, July 18, 2017 15:55:00 Seb via Digitalmars-d-learn wrote:
> On Tuesday, 18 July 2017 at 15:41:44 UTC, Meta wrote:
> > As Seb somewhat undiplomatically put, there are replacements
> > listed in the changelog.
>
> Sorry - it wasn't intended to be an offense or aggressive. I
> consider(ed)
On Tuesday, July 18, 2017 13:49:11 helxi via Digitalmars-d-learn wrote:
> import std.stdio, std.datetime, std.conv, std.algorithm;
>
> void main()
> {
> immutable DEADLINE = DateTime(2017, 7, 16, 23, 59,
> 59).to!SysTime;
> immutable NOW = Clock.currTime;
> immutable INTERVAL = (DEAD
Thanks for the replies. I will look at 3-address opcodes and
consider unions.
*Wonders if it matters that Program is a struct with opSlice /
opSliceAssign overloaded*.
Without them crashing the app running them? Say by wrapping with
try / catch?
You can assume that I've limited the opcode addresses to the
program and/or the data section which I'll try to put right next
to the code.
Reason is so I don't have to make my own VM.
I want to mutate computable
Hi,
I want to add a few flags while building with dub. I tried:
DFLAGS='-d-version=explain' dub test ...
...but DFLAGS does not seem to be honored. In fact I wouldn't
mind adding a builtType to my dub.sdl (but then will it be
inherited by the subpackages) but I don't see how to specify
f
On Tuesday, 18 July 2017 at 19:49:35 UTC, Jean-Louis Leroy wrote:
Hi,
I want to add a few flags while building with dub. I tried:
DFLAGS='-d-version=explain' dub test ...
...but DFLAGS does not seem to be honored. In fact I wouldn't
mind adding a builtType to my dub.sdl (but then will it
On Tuesday, 18 July 2017 at 20:00:48 UTC, Guillaume Piolat wrote:
On Tuesday, 18 July 2017 at 19:49:35 UTC, Jean-Louis Leroy
wrote:
Hi,
I want to add a few flags while building with dub. I tried:
DFLAGS='-d-version=explain' dub test ...
...but DFLAGS does not seem to be honored. In fact I
On Tuesday, 18 July 2017 at 20:12:13 UTC, Jean-Louis Leroy wrote:
On Tuesday, 18 July 2017 at 20:00:48 UTC, Guillaume Piolat
wrote:
On Tuesday, 18 July 2017 at 19:49:35 UTC, Jean-Louis Leroy
wrote:
Hi,
I want to add a few flags while building with dub. I tried:
DFLAGS='-d-version=explain'
On Tuesday, 18 July 2017 at 20:12:13 UTC, Jean-Louis Leroy wrote:
On Tuesday, 18 July 2017 at 20:00:48 UTC, Guillaume Piolat
wrote:
On Tuesday, 18 July 2017 at 19:49:35 UTC, Jean-Louis Leroy
wrote:
Hi,
I want to add a few flags while building with dub. I tried:
DFLAGS='-d-version=explain'
On Tuesday, 18 July 2017 at 12:39:01 UTC, Stefan Koch wrote:
whhhahhh template bloat
Yes, and also very slow. :)
On Tuesday, 18 July 2017 at 17:35:17 UTC, Enjoys Math wrote:
Without them crashing the app running them? Say by wrapping
with try / catch?
Run them in a separate process, so it can die independently.
On Tuesday, 18 July 2017 at 17:35:17 UTC, Enjoys Math wrote:
Without them crashing the app running them? Say by wrapping
with try / catch?
and, most probably a timeout, as you're certainly going to run
into infinite loops.
Reason is so I don't have to make my own VM.
Why not reuse an ex
On Tuesday, 18 July 2017 at 02:21:59 UTC, Enjoys Math wrote:
DMD32 D Compiler v2.074.1
import std.file;
void main() {
string bigInput = readText("input.txt");
}
The file is 7 MB of ascii text, don't know if that matters...
Should I upgrade versions?
Could you please share the first 32-b
38 matches
Mail list logo