On 05/07/2015 07:39 PM, Dennis Ritchie wrote:
On Friday, 8 May 2015 at 02:23:23 UTC, E.S. Quinn wrote:
It's because arrays are references types, and .dup is a strictly
shallow copy, so you're getting two outer arrays that reference
the same set of inner arrays. You'll have to duplicated each of
On 05/07/2015 09:17 PM, Meta wrote:
On Thursday, 7 May 2015 at 21:41:06 UTC, Nick Sabalausky wrote:
On 05/07/2015 05:19 PM, Justin Whear wrote:
T[] members = [ EnumMembers!T ];
Doh! Yup, that works.
Still, I would think there should be a way to do it without allocating
an array. But it's n
On 05/08/2015 12:06 AM, Nick Sabalausky wrote:
On 05/07/2015 11:24 PM, avarisclari wrote:
scene = scenes["title"]
It looks like scenes is a dictionary that stores dictionaries of
strings? If so, then in D, scenes would be declared like this:
string[string][string] scenes;
Then the above lin
I'm not really sure exactly what parts are the issue, but I'll point out
what I can:
On 05/07/2015 11:24 PM, avarisclari wrote:
Hello,
Sorry to bother you with something trivial, but I am having trouble
translating a block of code I wrote in Python over to D. Everything else
I've figured out s
Hello,
Sorry to bother you with something trivial, but I am having
trouble translating a block of code I wrote in Python over to D.
Everything else I've figured out so far. Could someone help me
understand how to get this right?
Here's the python:
scene = scenes["title"]
while 1 == 1:
On Friday, 8 May 2015 at 02:23:23 UTC, E.S. Quinn wrote:
It's because arrays are references types, and .dup is a strictly
shallow copy, so you're getting two outer arrays that reference
the same set of inner arrays. You'll have to duplicated each of
the inner arrays yourself if you need to make a
It's because arrays are references types, and .dup is a strictly
shallow copy, so you're getting two outer arrays that reference
the same set of inner arrays. You'll have to duplicated each of
the inner arrays yourself if you need to make a deep copy.
On Friday, 8 May 2015 at 02:15:38 UTC, Dennis
Hi,
Should the method .dup work with multidimensional arrays for
copying?
-
import std.stdio;
void main() {
auto a = [1, 2, 3];
auto b = a.dup;
b[] *= 2;
writeln("a = ", a); // [1, 2, 3] // OK
writeln("b = ", b); // [2, 4, 6] // OK
auto c
On 8/05/2015 1:53 p.m., Brian Schott wrote:
I have some code that automatically wires up control flow based on
annotations. Use of this code looks something like this:
```
import some_package.some_module;
void main(string[] args) {
doMagicStuff!(some_package.some_module)(args);
}
```
All of
I have some code that automatically wires up control flow based
on annotations. Use of this code looks something like this:
```
import some_package.some_module;
void main(string[] args) {
doMagicStuff!(some_package.some_module)(args);
}
```
All of this works and everything is happy (Except t
On Thursday, 7 May 2015 at 21:41:06 UTC, Nick Sabalausky wrote:
On 05/07/2015 05:19 PM, Justin Whear wrote:
On Thu, 07 May 2015 16:55:42 -0400, Nick Sabalausky wrote:
// There's gotta be a better way to convert
EnumMembers!T // to a
range, right? But std.range.only() didn't work, //
On Thursday, 7 May 2015 at 23:13:41 UTC, PhilipDaniels wrote:
On Thursday, 7 May 2015 at 23:10:26 UTC, PhilipDaniels wrote:
Let's try reformatting that...
ubyte r, g, b;
// does not compile
auto numRead = formattedRead(dropExactly(input, 4), "%x/%x/%x",
&r, &g, &b);
// does not compile
auto
On Thursday, 7 May 2015 at 23:23:08 UTC, Justin Whear wrote:
formattedRead takes its input by ref and consumes it. Your
first two
attempts are both passing the result of functions (dropExactly
and
opSlice) which are temporary rvalues and can thus not be passed
by
reference. Here's more readin
On Thu, 07 May 2015 23:10:26 +, PhilipDaniels wrote:
> Why do the first two fail to compile but the last one does?! I cannot
> see any difference between the 's2' case and the second case, it is a
> completely mechanical source code transformation I have made.
formattedRead takes its input by
On Thursday, 7 May 2015 at 23:10:26 UTC, PhilipDaniels wrote:
Let's try reformatting that...
ubyte r, g, b;
// does not compile
auto numRead = formattedRead(dropExactly(input, 4), "%x/%x/%x",
&r, &g, &b);
// does not compile
auto numRead = formattedRead(input[4..$], "%x/%x/%x", &r, &g, &b);
Given a string
string input = "rgb:20/30/40";
And the following:
ubyte r, g, b;
auto numRead = formattedRead(dropExactly(input, 4),
"%x/%x/%x", &r, &g, &b); // does not compile
auto numRead = formattedRead(input[4..$], "%x/%x/%x", &r,
&g,
&b);// does not c
On Thursday, 7 May 2015 at 20:55:42 UTC, Nick Sabalausky wrote:
// There's gotta be a better way to convert EnumMembers!T
// to a range, right? But std.range.only() didn't work,
// due to a template instantiation error.
T[] members;
foreach(m; EnumMembers!(T))
members
On Thursday, 7 May 2015 at 13:38:23 UTC, Andrea Fontana wrote:
Because it is a more generic operation and you can work on a
lazy range.
Anyway, to sort and to do uniq it isn't the fastest way.
Or maybe I just didn't understand what you really need. :)
Thanks. These are good ideas in general.
On 05/07/2015 05:19 PM, Justin Whear wrote:
On Thu, 07 May 2015 16:55:42 -0400, Nick Sabalausky wrote:
// There's gotta be a better way to convert EnumMembers!T // to a
range, right? But std.range.only() didn't work, // due to a
template instantiation error.
T[] members;
On Thu, 07 May 2015 16:55:42 -0400, Nick Sabalausky wrote:
> // There's gotta be a better way to convert EnumMembers!T // to a
> range, right? But std.range.only() didn't work, // due to a
> template instantiation error.
> T[] members;
> foreach(m; EnumMembers!(T))
>
Gah, missed some imports that time:
On 05/07/2015 05:04 PM, Nick Sabalausky wrote:
Minor fix to work right for "none" fields. Already worked fine on
combination fields liek "all".
-
enum Foo
{
none = 0,
optionA = 1<<0,
optionB = 1<<1,
opti
Minor fix to work right for "none" fields. Already worked fine on
combination fields liek "all".
-
enum Foo
{
none = 0,
optionA = 1<<0,
optionB = 1<<1,
optionC = 1<<2,
optionD = 1<<3,
all = optionA | optionB | optionC | optionD,
}
impo
On 05/07/2015 01:41 PM, Nick Sabalausky wrote:
Assuming a plain old bitfield-style enum like:
enum Foo {
optionA = 1<<0;
optionB = 1<<1;
optionC = 1<<2;
optionD = 1<<3;
optionE = 1<<4;
}
Does a function already exist somewhere to take an instance of Foo and
get a list o
On Thursday, 23 April 2015 at 14:40:01 UTC, Frank Pagliughi wrote:
I got the OK to submit the D library to Eclipse Paho. So,
hopefully within the next few weeks there will be a Paho
incubator project for the D language client.
Hi Frank,
any news about your MQTT client project?
Thank you
On Thursday, 7 May 2015 at 18:59:13 UTC, Suliman wrote:
shared static this()
{
auto router = new URLRouter;
router.get("/", &root);
auto settings = new HTTPServerSettings;
settings.port = 8080;
listenHTTP(settings, router);
}
void root(HTTPServerRequest req, HTT
On Thursday, 7 May 2015 at 18:59:13 UTC, Suliman wrote:
1. Do I need write "./public/" ? In examples often simply
"public/"
will work too. even "public"
it goes trough Path struct, see:
https://github.com/rejectedsoftware/vibe.d/blob/11578aa956a9b3b0e305d655f9668a867fdd89bd/source/vibe/inet/pat
shared static this()
{
auto router = new URLRouter;
router.get("/", &root);
auto settings = new HTTPServerSettings;
settings.port = 8080;
listenHTTP(settings, router);
}
void root(HTTPServerRequest req, HTTPServerResponse res)
{
serveStaticFiles("public/"
On Thursday, 7 May 2015 at 17:41:10 UTC, Nick Sabalausky wrote:
Assuming a plain old bitfield-style enum like:
enum Foo {
optionA = 1<<0;
optionB = 1<<1;
optionC = 1<<2;
optionD = 1<<3;
optionE = 1<<4;
}
Does a function already exist somewhere to take an instance of
Foo and
Assuming a plain old bitfield-style enum like:
enum Foo {
optionA = 1<<0;
optionB = 1<<1;
optionC = 1<<2;
optionD = 1<<3;
optionE = 1<<4;
}
Does a function already exist somewhere to take an instance of Foo and
get a list of the switch names as strings?
Something kinda lik
On Wed, 06 May 2015 14:26:43 +, rumbu wrote:
> operator overloads: opCom, opAdd, opSub ...
phobos' std.xml, std.variand and std.bitmanip are D1! ;-)
signature.asc
Description: PGP signature
On Thursday, 7 May 2015 at 09:21:58 UTC, Per Nordlöw wrote:
On Thursday, 7 May 2015 at 08:03:41 UTC, Andrea Fontana wrote:
It's not that difficult to implement.
You just need to implement a merge() range that returns the
min of all ranges' front(). Then you can define distinct() for
SortedRang
On Thursday, 7 May 2015 at 11:18:17 UTC, Daniel Kozak wrote:
On Thursday, 7 May 2015 at 11:15:02 UTC, Daniel Kozak wrote:
On Thursday, 7 May 2015 at 11:08:50 UTC, Daniel Kozák wrote:
On Thu, 07 May 2015 10:46:19 +
Lemonfiend via Digitalmars-d-learn
wrote:
On Thursday, 7 May 2015 at 10
On Thursday, 7 May 2015 at 10:19:44 UTC, Lemonfiend wrote:
Is it not possible to have a static function template with the
same name as the non-static version?
struct S
{
int i;
auto foo(T)(int j) {
i=j;
}
static auto foo(T)(int j) {
S s;
s.foo!T(j);
On Thursday, 7 May 2015 at 11:08:50 UTC, Daniel Kozák wrote:
On Thu, 07 May 2015 10:46:19 +
Lemonfiend via Digitalmars-d-learn
wrote:
On Thursday, 7 May 2015 at 10:43:28 UTC, Daniel Kozak wrote:
> On Thursday, 7 May 2015 at 10:39:09 UTC, Daniel Kozák wrote:
>>
>> On Thu, 07 May 2015 10:
On Thursday, 7 May 2015 at 11:15:02 UTC, Daniel Kozak wrote:
On Thursday, 7 May 2015 at 11:08:50 UTC, Daniel Kozák wrote:
On Thu, 07 May 2015 10:46:19 +
Lemonfiend via Digitalmars-d-learn
wrote:
On Thursday, 7 May 2015 at 10:43:28 UTC, Daniel Kozak wrote:
> On Thursday, 7 May 2015 at 1
On Thu, 07 May 2015 10:46:19 +
Lemonfiend via Digitalmars-d-learn
wrote:
> On Thursday, 7 May 2015 at 10:43:28 UTC, Daniel Kozak wrote:
> > On Thursday, 7 May 2015 at 10:39:09 UTC, Daniel Kozák wrote:
> >>
> >> On Thu, 07 May 2015 10:33:44 +
> >> Vadim Lopatin via Digitalmars-d-learn
> >
On Thursday, 7 May 2015 at 10:43:28 UTC, Daniel Kozak wrote:
On Thursday, 7 May 2015 at 10:39:09 UTC, Daniel Kozák wrote:
On Thu, 07 May 2015 10:33:44 +
Vadim Lopatin via Digitalmars-d-learn
wrote:
struct S
{
int i;
auto foo2(T)(int j) {
i=j;
}
static S foo(T)(i
On Thursday, 7 May 2015 at 10:39:09 UTC, Daniel Kozák wrote:
On Thu, 07 May 2015 10:33:44 +
Vadim Lopatin via Digitalmars-d-learn
wrote:
struct S
{
int i;
auto foo2(T)(int j) {
i=j;
}
static S foo(T)(int j) {
S s;
s.foo2!T(j);
retu
On Thursday, May 07, 2015 10:19:42 Lemonfiend via Digitalmars-d-learn wrote:
> Is it not possible to have a static function template with the
> same name as the non-static version?
No. Unfortunately, you can't overload based on static. I believe that it
works if they're overloaded on parameters bu
On Thu, 07 May 2015 10:33:44 +
Vadim Lopatin via Digitalmars-d-learn
wrote:
> struct S
> {
> int i;
>
> auto foo2(T)(int j) {
> i=j;
> }
>
> static S foo(T)(int j) {
> S s;
> s.foo2!T(j);
> return s;
> }
> }
>
> void main()
> {
On Thu, 07 May 2015 10:19:42 +
Lemonfiend via Digitalmars-d-learn
wrote:
> Is it not possible to have a static function template with the
> same name as the non-static version?
>
> struct S
> {
> int i;
>
> auto foo(T)(int j) {
> i=j;
> }
>
> static auto foo(
On Thursday, 7 May 2015 at 10:19:44 UTC, Lemonfiend wrote:
Is it not possible to have a static function template with the
same name as the non-static version?
struct S
{
int i;
auto foo(T)(int j) {
i=j;
}
static auto foo(T)(int j) {
S s;
s.foo!T(j);
On Thu, 07 May 2015 10:19:42 +
Lemonfiend via Digitalmars-d-learn
wrote:
> Is it not possible to have a static function template with the
> same name as the non-static version?
>
> struct S
> {
> int i;
>
> auto foo(T)(int j) {
> i=j;
> }
>
> static auto foo(
Is it not possible to have a static function template with the
same name as the non-static version?
struct S
{
int i;
auto foo(T)(int j) {
i=j;
}
static auto foo(T)(int j) {
S s;
s.foo!T(j);
return s;
}
}
void main()
{
auto s = S.foo!boo
Later you can have more sophisticated methods, e.g. if you want
to handle query strings you could do something like this:
import vibe.d;
shared static this()
{
auto settings = new HTTPServerSettings;
settings.port = 8080;
settings.bindAddresses = ["::1", "127.0.0.1"];
auto router = ne
On Thursday, 7 May 2015 at 09:27:39 UTC, Chris wrote:
On Thursday, 7 May 2015 at 08:25:30 UTC, Suliman wrote:
You're not setting a port.
add:
settings.port = 8080;
before listenHTTP();
then it'll work.
It's do not help :(
This should work, put it in your `app.d` file:
import vibe.d;
sha
On Thursday, 7 May 2015 at 09:21:58 UTC, Per Nordlöw wrote:
I was only interested in removing equal consequtive elements
within the same range.
I looked at UniqResult. What we need is to fix the typesystem
with perhaps some traits the figure out which ranges
(multi-layered meta-ranges) posses
On Thursday, 7 May 2015 at 08:25:30 UTC, Suliman wrote:
You're not setting a port.
add:
settings.port = 8080;
before listenHTTP();
then it'll work.
It's do not help :(
This should work, put it in your `app.d` file:
import vibe.d;
shared static this()
{
auto settings = new HTTPServerSe
On Thursday, 7 May 2015 at 08:03:41 UTC, Andrea Fontana wrote:
It's not that difficult to implement.
You just need to implement a merge() range that returns the min
of all ranges' front(). Then you can define distinct() for
SortedRange as:
merge(sortedrange1, sortedrange2, sortedrange3).uniq
On Thursday, 7 May 2015 at 09:08:53 UTC, wobbles wrote:
On Thursday, 7 May 2015 at 08:25:30 UTC, Suliman wrote:
You're not setting a port.
add:
settings.port = 8080;
before listenHTTP();
then it'll work.
It's do not help :(
You're sure?
My app.d is:
import std.stdio;
import vibe.d;
shar
On Thursday, 7 May 2015 at 08:25:30 UTC, Suliman wrote:
You're not setting a port.
add:
settings.port = 8080;
before listenHTTP();
then it'll work.
It's do not help :(
You're sure?
My app.d is:
import std.stdio;
import vibe.d;
shared static this(){
auto router = new URLRouter;
You're not setting a port.
add:
settings.port = 8080;
before listenHTTP();
then it'll work.
It's do not help :(
On Thursday, 7 May 2015 at 08:09:50 UTC, Suliman wrote:
Is next example is enough to serv simple index.html page?
void setupServer()
{
auto router = new URLRouter;
// add other routes here
router.get("*", serveStaticFiles("public/"));
auto settings = new HTTPServ
Is next example is enough to serv simple index.html page?
void setupServer()
{
auto router = new URLRouter;
// add other routes here
router.get("*", serveStaticFiles("public/"));
auto settings = new HTTPServerSettings;
listenHTTP(settings, router);
}
Afte
On Thursday, 7 May 2015 at 06:53:39 UTC, Per Nordlöw wrote:
On Wednesday, 6 May 2015 at 16:05:15 UTC, Andrea Fontana wrote:
Maybe a way like this could be useful:
http://dpaste.dzfl.pl/7b4b37b490a7
If r is a SortedRange this is very unneccesary wasteful because
of the use AA.
In that case y
55 matches
Mail list logo