Surely a stupid mistake on my part, but why is the first array
repeated?
import std.stdio;
void main()
{
int[]*[2] a; // a static arrray holding pointers to dynamic
arrays
static int unique = 0;
foreach(i, elem; a)
{
int[] temp = new int[](5);
foreach(ref
I think I got a handle on D's static and dynamic arrays, till I
come to std.array and see all the shiny new tools. I can
understand all the replace.. functions, but the appender function
gave me pause. The documentation says appender "Returns a new
Appender or RefAppender initialized with a
On Friday, 6 October 2017 at 23:02:56 UTC, Laeeth Isharc wrote:
On Thursday, 5 October 2017 at 21:48:20 UTC, WhatMeWorry wrote:
I've got a github project and using DUB with DMD and I keep
running into this problem. I've tried deleting the entire
...\AppData\Roaming\dub\packages folder, but
This is taken exactly from the traits documentation.
25 Traits
25.21 identifier
Takes one argument, a symbol. Returns the identifier for that
symbol as a string literal.
There are no
On Sunday, 20 August 2017 at 22:50:40 UTC, Johnson Jones wrote:
On Sunday, 20 August 2017 at 19:27:43 UTC, WhatMeWorry wrote:
[...]
It's not difficult, it's just new. It's not that you are a poor
programmer, but you simply have not learned how to think about
mixins correctly. Stop whining
On Sunday, 20 August 2017 at 19:41:14 UTC, Ali Çehreli wrote:
On 08/20/2017 12:27 PM, WhatMeWorry wrote:
> // Mixins are for mixing in generated code into the
source code.
> // The mixed in code may be generated as a template
instance
> // or a string.
Yes, it means that the string
Can someone explain what is the difference between the two?
Thanks.
module gates;
import std.stdio;
import std.random;
alias Calculator = int delegate(int);
Calculator makeCalculator()
{
static int context = 0;
int randy = uniform(1, 7);
context++;
writeln("context = ",
module block_template;
void main()
{
template BluePrint(T, U)
{
T integer;
U floatingPoint;
}
BluePrint!(int, float);
}
// DMD returns
// template.d(13): Error: BluePrint!(int, float) has no effect
// I was expecting something like the following to be created
Static Arrays have property
.sizeof which returns the array length multiplied by the number
of bytes per array element.
Dynamic Arrays have property
.sizeof which returns the size of the dynamic array reference,
which is 8 in 32-bit builds and 16 on 64-bit builds.
Why not have dynamic
On Tuesday, 18 July 2017 at 17:35:17 UTC, Enjoys Math wrote:
The purpose of it is to make a real-time, short-lived function
predictor.
I'm genuinely curious. What is a function predictor used for?
I was playing around with regex
import std.regex;
import std.stdio;
void main()
{
string[] fileNames = [ "011_bad.txt", "01_01_pass",
"90_pass", "_bad" ];
auto reg = regex(r"^\d{2}_");
foreach (name; fileNames)
{
auto c = matchFirst(name, reg);
Just trying to compile a "Hello World" using dub and ldc2. The 32
bit works fine:
generic@generic-ThinkPad-T61:~/Desktop/test$ dub run
--compiler=ldc2 --arch=x86
Performing "debug" build using ldc2 for x86.
test ~master: target for configuration "application" is up to
date.
To force a
One of my D books says: "an enum declared without any braces is
called a manifest constant." The example shows,
enum string author = "Mike Parker";
Is this equivalent to
const string author = "Mike Parker";
or
immutable string author = "Mike Parker";
I guess what I'm asking is does enum
On Wednesday, 22 February 2017 at 22:37:25 UTC, Profile Anaysis
wrote:
On Wednesday, 22 February 2017 at 21:27:47 UTC, WhatMeWorry
wrote:
I'm doing conditional compilation using static ifs like so:
enum bool audio = true;
// if audio flag is present and set to true, add to code
On Saturday, 1 August 2015 at 09:35:53 UTC, DLearner wrote:
Does the D language set in stone that the first element of an
array _has_ to be index zero?
Wouldn't starting array elements at one avoid the common
'off-by-one' logic error, it does
seem more natural to begin a count at 1.
Actually,
On Saturday, 15 October 2016 at 01:46:52 UTC, Chris Nelson wrote:
I'm mainly a scripting language, .NET, and SQL programmer. I've
been looking for a good programming language for Linux/BSD
other than Python. I've surveyed the options and D appears to
be a sane modern choice for me. (Thanks Ali
16 matches
Mail list logo