On Thursday, 3 March 2016 at 10:35:50 UTC, MGW wrote:
The citation from https://dlang.org/spec/hash-map.html
Static Initialization of AAs
immutable long[string] aa = [
"foo": 5,
"bar": 10,
"baz": 2000
];
unittest
{
assert(aa["foo"] == 5);
On Thursday, 3 March 2016 at 10:01:47 UTC, MGW wrote:
immutable long[string] aa = [
"foo": 5,
"bar": 10,
"baz": 2000
];
... Error: non-constant expression ["foo":5L, "bar":10L,
"baz":2000L]
D associative arrays are a dynamic runtime feature, thus can't be
initialized without
import std.stdio : writeln;
struct foo
{
long* bar;
this (long l)
{
long d = l;
bar =
}
}
int main()
{
foo f = foo(12345);
writeln(*f.bar);
//writefoo(f);
writeln(*f.bar);
return 0;
}
void writefoo(foo f)
{
writeln(*f.bar);
}
If I
On Friday, 26 February 2016 at 00:40:40 UTC, Steven Schveighoffer
wrote:
ugh!
history = line ~ history[0 .. $ - 1];
That works alot better =)
Trying to uncook the terminal failed however. It can't recognize
struct tag-declarations I think:
/*
copy-paste code from:
On Friday, 26 February 2016 at 04:03:15 UTC, BBasile wrote:
e.g the DMD equivalent for the two previous example is
DMD "sourceThis.d" "folder/interface.di" "folder/binary.a"
-ofbin/thesoft
You can mix unlinked binaries and text-editor source files on
commandline? Didn't know that when I
On Thursday, 25 February 2016 at 21:46:40 UTC, asdf wrote:
Hi, me again. I'm having trouble making a demonstration and not
sure if is obsolete or not anyways. :/
Anyways take a look here.
http://www.tutorialspoint.com/python/python_further_extensions.htm
On Thursday, 25 February 2016 at 21:40:45 UTC, Wyatt wrote:
I have a project I started in Python before I realised I really
don't enjoy Python. It's been on the back-burner for a few
years and I'd like to start again in D, but there's a
particular python module (Mutagen) that I outright
On Thursday, 25 February 2016 at 19:21:31 UTC, Steven
Schveighoffer wrote:
On 2/25/16 2:12 PM, Steven Schveighoffer wrote:
I believe you could use std.algorithm.copy, but probably need
to do it
with retro as well.
Heh, or of course use memmove :)
-Steve
I got the history list working
On Wednesday, 24 February 2016 at 21:48:14 UTC, mahdi wrote:
Suppose we have a function like this:
void diss(int[] array) ...
How can we detect is `array` is static (fixed size) or dynamic,
inside the function body?
I don't understand what I'm doing but got a proof of concept for
you. This
On Thursday, 25 February 2016 at 13:06:10 UTC, cym13 wrote:
In D the binary operator "~" is used to concatenate both
strings (arrays of characters) and arrays. (also the ~=
operator is equivalent to lhs = lhs ~ rhs
Nic
Just a precision: "lhs ~= rhs" isn't exactly equivalent to
"lhs =
On Thursday, 25 February 2016 at 12:58:54 UTC, Nicholas Wilson
wrote:
In D the binary operator "~" is used to concatenate both
strings (arrays of characters) and arrays. (also the ~=
operator is equivalent to lhs = lhs ~ rhs
Nic
It worked! A link from someone else's question suggested
I'm trying to make a terminal input preprocessor with
alias/shortcuts and history.
import std.stdio;
void main() {
string line;
string[] history;
line = readln();
foreach(int i; 0..100) history = history + [""]; // XXX
while(!stdin.eof) {
writeln(line);
Okay so it turns out putting something in another thread is like
throwing it into an alternate universe where only my functions
exist, and instead of telling me my data doesn't exist, it just
silently behaves as if it's all empty
Man, threads are weird. I'll just pass the data in as an
Okay it somehow just got even stranger
that condition 'tokenIsAnOperator' in that code is a function to
test whether the token is contained within the array ["+", "-",
"*", "/"]
It seems that sometimes it returns true for "*", and sometimes
false, but only when I have "parallel" in that
On Saturday, 30 January 2016 at 05:41:10 UTC, tsbockman wrote:
On Saturday, 30 January 2016 at 05:15:58 UTC, asdf wrote:
Okay so it turns out putting something in another thread is
like throwing it into an alternate universe where only my
functions exist, and instead of telling me my data
I'm writing a program to parse and evaluate mathematical
expressions
the parse tree is in the format:
struct node
{
string token;
node*[] children;
}
it is parsed such that for the input 1*(2+3)-4*(5+6), the tree
ends up looking like
-
* *
1 + 4 +
16 matches
Mail list logo