I can't seem to be able to use `--profile` with vibe:
```shell
dub init -t vibe.d
dub build --build=profile
../../.dub/packages/vibe-core/2.7.3/vibe-core/source/vibe/internal/async.d-mixin-119(142,3):
Warning: statement is not reachable
On Friday, 19 January 2024 at 08:57:40 UTC, Renato wrote:
Do you know why the whole thread seems to have disappeared??
There's a lot of good stuff in the thread, it would be a huge
shame to lose all that!
I agree! Thanks for posting your benchmarks, I thought your whole
benching setup was
On Saturday, 13 January 2024 at 11:03:42 UTC, Renato wrote:
I like to use a phone encoding problem to determine the
strenghtness and weaknesses of programming languages because
this problem is easy enough I can write solutions in any
language in a few hours, but complex enough to exercise lots
On Wednesday, 22 June 2022 at 16:02:00 UTC, mw wrote:
Hi,
I know with PyD, D can call Python, and with autowrap, Python
can call a D .dll, I'm just wondering if someone can show an
example that Python <==> d can call both ways? esp. show
passing D objects to Python and then call its member
On Thursday, 18 November 2021 at 16:08:22 UTC, Paul Backus wrote:
On Thursday, 18 November 2021 at 13:51:42 UTC, Martin
Tschierschke wrote:
[...]
You can define a `toString` method, like this:
```d
string toString()
{
import std.conv;
return p.to!string;
}
```
You can find more
On Wednesday, 23 June 2021 at 22:46:28 UTC, Steven Schveighoffer
wrote:
On 6/23/21 6:30 PM, Jordan Wilson wrote:
On Wednesday, 23 June 2021 at 19:53:24 UTC, someone wrote:
[...]
```sort``` returns a ```SortedRange```, and I believe you wish
to return a float. So you can do either ```return
On Wednesday, 23 June 2021 at 19:53:24 UTC, someone wrote:
Please, look for the line marked +++
This is a structure with a public property returning a (still
unsorted) range built on-the-fly from already-set properties, a
basic range from a to z with n step where some specific values
can be
On Saturday, 22 May 2021 at 20:28:56 UTC, rempas wrote:
I've read the documentation about DUB's config (I'm using the
SDL format) and it seems that DUB completely ignores my config.
My config file is:
```
name "test"
description "Testing dub"
authors "rempas"
copyright "Copyright © 2021,
On Sunday, 16 May 2021 at 09:55:31 UTC, Chris Piker wrote:
On Sunday, 16 May 2021 at 09:17:47 UTC, Jordan Wilson wrote:
Another example:
```d
auto r = [iota(1,10).map!(a => a.to!int),iota(1,10).map!(a =>
a.to!int)];
# compile error
```
Hi Jordan
Nice succinct example. Thanks for looking
On Sunday, 16 May 2021 at 07:20:52 UTC, Chris Piker wrote:
On Saturday, 15 May 2021 at 14:05:34 UTC, Paul Backus wrote:
If you post your code (or at least a self-contained subset of
it) someone can probably help you figure out where you're
running into trouble. The error messages by
On Wednesday, 21 April 2021 at 15:07:25 UTC, JG wrote:
On Wednesday, 21 April 2021 at 00:39:41 UTC, Mike Parker wrote:
On Tuesday, 20 April 2021 at 18:43:28 UTC, JG wrote:
This still leaves open the question of how to include a
version of such a library in another project via dub.
Execute
On Thursday, 25 March 2021 at 04:00:33 UTC, Chris Piker wrote:
On Tuesday, 23 March 2021 at 05:54:13 UTC, mw wrote:
[...]
Okay, that's done.
The repo https://github.com/das-developers/deimos.cdf and
package https://code.dlang.org/packages/cdf have been drafted
and tested on Linux, I'm
On Sunday, 15 March 2020 at 17:58:58 UTC, Steven Schveighoffer
wrote:
I want to try and learn how to write 2d games. I'd prefer to do
it with D.
I've found a ton of tutorials on learning 2d gaming with other
languages. Is there a place to look that uses D for learning?
Should I just start
On Wednesday, 26 February 2020 at 20:06:20 UTC, mark wrote:
There seems to be some support for SQLite 3 in std. lib. etc
when looking at the stable docs:
https://dlang.org/phobos/etc_c_sqlite3.html
But this isn't visible when looking at stable (ddox).
Is this the best SQLite 3 library to use
On Thursday, 29 August 2019 at 10:11:58 UTC, berni wrote:
Iterating of some structure and removing elements thereby is
always errorprone and should be avoided. But: In case of AA,
I've got the feeling, that it might be safe:
foreach (k,v;ways)
if (v.empty)
ways.remove(k);
Do
On Friday, 2 August 2019 at 22:35:53 UTC, Adam D. Ruppe wrote:
On Friday, 2 August 2019 at 21:44:28 UTC, Jordan Wilson wrote:
// outputs 1 2 2 3
z.map!(a => tuple!("number","iseven")(a, a.isEven))
.filter!(a => a.iseven)
.array;
I *think* what's happening
Hello,
I don't quite understand why isEven is called twice in the 2nd
example?
auto isEven(int n) {
n.writeln;
return (n % 2) == 0;
}
void main() {
auto z = [1,2,3];
// outputs 1 2 3
z.map!(a => tuple!("number")(a))
.filter!(a =>
On Friday, 5 July 2019 at 00:54:15 UTC, Samir wrote:
Is there a cleaner way of finding the maximum value of say the
third column in a multi-dimensional array than this?
int[][] p = [[1,2,3,4], [9,0,5,4], [0,6,2,1]];
writeln([p[0][2], p[1][2], p[2][2]].max);
I've tried the following
writeln([0,
On Tuesday, 26 February 2019 at 19:58:24 UTC, Andrey wrote:
Hello,
How to break from parallel foreach?
More general question - how to control such loop?
A basic way would be to use a flag:
shared stopWork=false;
foreach (wordBag; wordBags.parallel) {
if (!stopWork) {
// do work
On Sunday, 3 February 2019 at 18:07:13 UTC, Chris Bare wrote:
auto matches = matchAll(str, searchRegex);
foreach (m; matches) // this walks the list forward
I tried:
foreach_reverse (m; matches)
foreach (m; reverse (matches))
foreach (m; retro (matches))
and they all failed to compile.
I also
On Wednesday, 17 October 2018 at 22:37:53 UTC, Stanislav Blinov
wrote:
On Wednesday, 17 October 2018 at 22:30:31 UTC, Jordan Wilson
wrote:
Ideally, I'd check args before I take the time to load up data.
https://dlang.org/phobos/core_runtime.html#.Runtime
Here I was looking through
Hello,
Is there a way to access command line arguments outside of main?
// main.d
module main;
import data;
void main(string args[]) {
}
// data.d
module data
immutable programData;
static this() {
// read in data
}
Ideally, I'd check args before I take the time to load up data.
On Friday, 20 July 2018 at 12:03:20 UTC, evilrat wrote:
On Friday, 20 July 2018 at 04:31:38 UTC, Jordan Wilson wrote:
On Friday, 20 July 2018 at 01:34:39 UTC, Mike Parker wrote:
On Thursday, 19 July 2018 at 21:43:35 UTC, Jordan Wilson
wrote:
Is there any way I can generate the appropriate
On Friday, 20 July 2018 at 05:12:05 UTC, Mike Parker wrote:
On Friday, 20 July 2018 at 04:31:38 UTC, Jordan Wilson wrote:
I don't have MSVC, so I built it using mingw, which generated
a .a lib.
I shall google some more, as I understand it DMD -m64 uses
Mingw libs as a fall back when MSVC not
On Friday, 20 July 2018 at 01:34:39 UTC, Mike Parker wrote:
On Thursday, 19 July 2018 at 21:43:35 UTC, Jordan Wilson wrote:
Is there any way I can generate the appropriate lib?
Else I think I'll need to get hold of the proper import libs
that come with the Lua distribution.
Lua is
I'm trying to create an import library from a dll (in this case,
a Lua dll).
Using dumpbin, I end up with a .def file:
EXPORTS
luaL_addlstring
luaL_addstring
luaL_addvalue
luaL_argerror
luaL_buffinit
...
I then use MS lib tool to generate a lib file:
lib /def:lua53.def /out:lua53.lib
On Thursday, 28 June 2018 at 19:22:38 UTC, Jonathan M Davis wrote:
On Thursday, June 28, 2018 18:10:07 kdevel via
Digitalmars-d-learn wrote:
On Tuesday, 26 June 2018 at 21:54:49 UTC, Jonathan M Davis
wrote:
> [H]onestly, I don't understand why folks keep trying to put
> nullable types in
On Wednesday, 20 June 2018 at 05:49:15 UTC, Dukc wrote:
On Wednesday, 20 June 2018 at 03:44:58 UTC, Jordan Wilson wrote:
Is there anything I can do to improve zip, before I go ahead
and change to the faster but slightly less readable enumerate?
The problem might be that zip checks both arrays
Hello,
Idiomatically, I make use of zip, however, when looking to speed
up my program, notice that using enumerate leads to a 20-30%
improvement:
void main(){
auto x = iota(1_000).array;
auto y = iota(1_000).array;
auto func1() {
return zip(x,y).map!(a => a[0]+a[1])
On Wednesday, 25 April 2018 at 13:52:16 UTC, Steven Schveighoffer
wrote:
[...]
Great, thanks for you help Steve, I'll have a think about how I
want to structure things.
Jordan
On Tuesday, 24 April 2018 at 23:49:14 UTC, Steven Schveighoffer
wrote:
What you are missing is that Database is pass-by-value, not a
class. So when you include it directly in a class like you did
in A, then when A's destructor is called, db's destructor is
called.
Since in the first case, a
I have the following code:
import std.stdio;
import std.typecons;
import d2sqlite3;
class A {
Database db;
this ( Database d) {
db = d;
}
}
class B {
Database* db;
this ( Database* d) {
db = d;
}
}
void main() {
auto db = Database(":memory:");
On Tuesday, 3 April 2018 at 19:02:25 UTC, Vladimirs Nordholm
wrote:
Hello people.
I currently have a function which multiple times per second
takes in arguments, and appends the argument as my special
type. The following code should explain what I do more properly:
struct MySpecialType
On Monday, 18 September 2017 at 21:58:39 UTC, Alex wrote:
On Monday, 18 September 2017 at 18:49:54 UTC, ag0aep6g wrote:
Doesn't work for me. This still fails compilation with the
same error:
import std.algorithm.iteration : sum, cumulativeFold;
void main()
{
double[5] a;
auto
On Thursday, 22 March 2018 at 03:58:35 UTC, Seb wrote:
On Thursday, 22 March 2018 at 03:39:38 UTC, Jordan Wilson wrote:
auto a = iota(5).slide!(Yes.withPartial)(3);
auto b = iota(5).slide!(No.withPartial)(3);
assert (a.equal(b));
The assert passes, but I would expect it to fail? They both
auto a = iota(5).slide!(Yes.withPartial)(3);
auto b = iota(5).slide!(No.withPartial)(3);
assert (a.equal(b));
The assert passes, but I would expect it to fail? They both are:
[[0,1,2],[1,2,3],[2,3,4]]
Thanks,
Jordan
On Monday, 12 March 2018 at 02:49:34 UTC, Jonathan M Davis wrote:
On Monday, March 12, 2018 02:11:49 Jordan Wilson via
Digitalmars-d-learn wrote:
[...]
Maybe iota should be made to work, but as present, it basically
wants all three of the types it's given to be the same or
implicitly
I wanted to iterate through a date range, so I initially tried:
iota(Date(2016,1,1),Date(2018,1,1),dur!"days"(1));
That wouldn't compile, which is fair enough I guess.
So I tried a for loop:
for (auto i = Date(2016,1,1); i < Date(2018,1,1);
i+=dur!"days"(1)){}
That seemed to work fine, but I
On Sunday, 18 February 2018 at 17:54:58 UTC, SrMordred wrote:
I´m experimenting with threads and related recently.
(i´m just started so may be some terrrible mistakes here)
With this base work:
foreach(i ; 0 .. SIZE)
{
results[i] = values1[i] * values2[i];
}
and then with this 3 others
On Sunday, 10 December 2017 at 16:50:10 UTC, RegeleIONESCU wrote:
Hello!
Please help me install and use Derelict on Ubuntu 16.04!
[...]
I use Code::Blocks myself, but doesn't have inbuilt dub support.
This link should help:
http://derelictorg.github.io/building/without-dub/
This will tell
On Wednesday, 20 September 2017 at 06:29:17 UTC, Vino.B wrote:
Hi All,
My code output's the below so can any one help me on hot to
merege all tese array and sort the same.
Output :
[ Tuple!(string, string)("C:\\Temp\\TEST1\\BACKUP\\DND1.pdf",
"2017-Sep-06 16:06:42") ]
[ Tuple!(string,
On Tuesday, 30 May 2017 at 10:54:49 UTC, Solomon E wrote:
The earlier version of the page made D look more error prone
than other languages, but short. Now my solution is as long as
some of the other language's solutions, but it's well commented
and tested, I think. Now I doubt any of the
On Tuesday, 30 May 2017 at 20:37:44 UTC, Jordan Wilson wrote:
On Tuesday, 30 May 2017 at 20:02:38 UTC, Nitram wrote:
After reading
https://dlang.org/blog/2017/05/24/faster-command-line-tools-in-d/ , i was wondering how fast one can do a simple "wc -l" in D.
So i made a couple short
On Tuesday, 30 May 2017 at 20:02:38 UTC, Nitram wrote:
After reading
https://dlang.org/blog/2017/05/24/faster-command-line-tools-in-d/ , i was wondering how fast one can do a simple "wc -l" in D.
So i made a couple short implementations and found myself
confronted with slow results compared
On Friday, 26 May 2017 at 06:31:49 UTC, realhet wrote:
Hi,
I'm kinda new to the D language and I love it already. :D So
far I haven't got any serious problems but this one seems like
beyond me.
import std.stdio;
void main(){
foreach(i; 0..2000){
writeln(i);
auto st = new
On Thursday, 11 May 2017 at 18:07:47 UTC, H. S. Teoh wrote:
On Thu, May 11, 2017 at 05:55:03PM +, k-five via
Digitalmars-d-learn wrote:
On Thursday, 11 May 2017 at 17:18:37 UTC, crimaniak wrote:
> On Wednesday, 10 May 2017 at 12:40:41 UTC, k-five wrote:
On Friday, 17 March 2017 at 00:35:32 UTC, Philip Miess wrote:
This is my first 100+ line D program.
https://gitlab.com/pmiess/101gamesDlangComputerGames/blob/master/
aceyducy.d
Its a translation/refactor of aceyducy from 101 basic programs.
Could someone look over it and see if I've made any
On Friday, 3 March 2017 at 03:11:24 UTC, steven kladitis wrote:
void main() {
import std.stdio, std.range, std.algorithm, std.string;
const pieces = "KQRrBbNN";
alias I = indexOf;
auto starts = permutations(pieces.dup).filter!(p =>
I(p, 'B') % 2 != I(p, 'b') % 2 &&
On Thursday, 2 March 2017 at 01:02:39 UTC, Mike Parker wrote:
On Wednesday, 1 March 2017 at 16:12:06 UTC, bauss wrote:
There is a better binding.
dsfml.
You can find it here: http://dsfml.com/
DSFML technically is not a binding (even though it says such on
the web site). It's a wrapper
On Tuesday, 28 February 2017 at 20:49:39 UTC, crimaniak wrote:
On Sunday, 26 February 2017 at 21:50:38 UTC, Jordan Wilson
wrote:
.map!(a => a.to!double)
If lambda just calls another function you can pass it directly:
== .map!(to!double)
Learn something new everyday, thanks :-)
Hello,
Been trying to learn the Simple Fast Multimedia Library (SFML)
using the Derelict bindings, and noticed some functionality is
offered by both SFML and the std library (for example, sfClock
and sfMutex).
Is there a general design principle of, say, use the std library
whenever
On Sunday, 29 January 2017 at 23:42:40 UTC, Jordan Wilson wrote:
On Sunday, 29 January 2017 at 21:41:57 UTC, albert-j wrote:
On Saturday, 28 January 2017 at 11:54:58 UTC, cym13 wrote:
[...]
I am trying to wrap my head around lazy evaluation during
filtering/mapping, but there's something I
On Sunday, 29 January 2017 at 21:41:57 UTC, albert-j wrote:
On Saturday, 28 January 2017 at 11:54:58 UTC, cym13 wrote:
[...]
I am trying to wrap my head around lazy evaluation during
filtering/mapping, but there's something I don't understand.
I want to create an array, square some elements,
On Thursday, 26 January 2017 at 08:22:09 UTC, albert-j wrote:
What is the D idiom for removing array elements that are
present in another array?
Is this the right/fastest way?
int[] a = [1, 2, 3, 4, 5, 6, 7, 4];
int[] b = [3, 4, 6];
auto c = a.remove!(x => b.canFind(x));
assert(c == [1, 2, 5,
On Wednesday, 18 January 2017 at 22:39:02 UTC, Ali Çehreli wrote:
On 01/18/2017 02:02 PM, Jordan Wilson wrote:
[...]
Yes, can be better with something similar to the following:
struct Foo {
string bar;
}
string value(U : Foo)(U u) {
return u.bar;
}
string value(U : string)(U u) {
I have a simple comparison function:
struct Foo {
string bar;
}
auto sameGroup(T,S) (T a, S b) {
static assert (is(T == string) || is(T == Foo));
static assert (is(S == string) || is(S == Foo));
string aStr;
string bStr;
static if (is(T == string)){
aStr = a;
Hello,
For tuples, does the fieldNames property have a 1-1
correspondence with the Types property?
It appears that way in my testing:
alias MyData = Tuple!(string,"a",int,"b");
foreach (i, type; MyData.Types){
writeln (MyData.fieldNames[i]," ",type.stringof);
// a string
// b int
On Thursday, 3 September 2015 at 22:48:01 UTC, Jordan Wilson
wrote:
On Thursday, 3 September 2015 at 22:21:57 UTC, Namal wrote:
ep18.d(10): Error: no property 'split' for type 'char[]'
/usr/include/dmd/phobos/std/algorithm.d(427):
instantiated from here: MapResult!(__lambda1,
Actually, need an extra map I think:
auto word = file.byLine()
.map!(a => a.split)
.map!(a => map!(a => to!int(a))(a))
.array();
On Thursday, 3 September 2015 at 22:21:57 UTC, Namal wrote:
ep18.d(10): Error: no property 'split' for type 'char[]'
/usr/include/dmd/phobos/std/algorithm.d(427):
instantiated from here: MapResult!(__lambda1, ByLine!(char,
char))
ep18.d(10):instantiated from here:
And also:
import std.algorithm
Sorry, I should have taken the time to answer properly and fully.
On Thursday, 3 September 2015 at 23:28:37 UTC, Namal wrote:
On Thursday, 3 September 2015 at 23:25:52 UTC, Jordan Wilson
wrote:
And also:
import std.algorithm
Sorry, I should have taken the time to answer properly and
fully.
import std.file, std.stdio, std.string, std.conv, std.algorithm;
On Friday, 4 September 2015 at 00:18:15 UTC, Namal wrote:
On Thursday, 3 September 2015 at 23:54:44 UTC, H. S. Teoh wrote:
[...]
Thx Theo, this and the lack of foolproof tutorials were the
reason why I gave up on D 2 years ago and went instead to C++.
But I am not giving up this time. That
Hello,
Just wondering why compiling the following fails with the -debug
switch, but appears to compile and execute fine without it:
import std.stdio;
import std.algorithm;
import std.container;
int main(string[] args) {
Array!string letters = [b,a,c];
sort(letters[]);
writeln
64 matches
Mail list logo