Re: RedBlackTree thin wrapper initialization

2014-05-28 Thread Edwin van Leeuwen via Digitalmars-d
On Wednesday, 28 May 2014 at 08:46:30 UTC, Rene Zwanenburg wrote: The problem is the initialization of A.tree. Short answer, move it to a constructor and it should work. Now what I think is going on: default values for member fields must be known at compile time. This is why structs can do

Re: RedBlackTree thin wrapper initialization

2014-05-29 Thread Edwin van Leeuwen via Digitalmars-d
On Wednesday, 28 May 2014 at 16:25:40 UTC, Rene Zwanenburg wrote: On Wednesday, 28 May 2014 at 09:37:55 UTC, Edwin van Leeuwen wrote: Thank you for the reply. Does this mean I should never initialize classes/objects like that or is it more specific to RBT? It's the same for any class. I

Re: Who pays for all this?

2014-10-06 Thread Edwin van Leeuwen via Digitalmars-d
On Monday, 6 October 2014 at 04:09:11 UTC, Andrei Alexandrescu wrote: I believe a foundation would help D. Unfortunately, setting one up is very laborious, and neither Walter nor I know anything about that - from what I understand it takes a _lot_ of work. If anyone is able and willing to

Delegate, scope and associative array

2014-06-02 Thread Edwin van Leeuwen via Digitalmars-d-learn
I'm probably missing something basic, but I am confused by what is going on in the following code. unittest { size_t delegate()[size_t] events; foreach( i; 1..4 ) { events[i] = { return i; }; } writeln( events[1]() ); // This outputs 3 assert( events[1]() == 1 ); }

Re: Delegate, scope and associative array

2014-06-02 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 2 June 2014 at 23:44:01 UTC, Rene Zwanenburg wrote: On Monday, 2 June 2014 at 20:09:12 UTC, Edwin van Leeuwen wrote: As you may have guessed, a workaround is to copy the iteration variable yourself: unittest { size_t delegate()[size_t] events; foreach(_i; 1..4 ) {

Re: Delegate, scope and associative array

2014-06-03 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Tuesday, 3 June 2014 at 05:40:44 UTC, Edwin van Leeuwen wrote: On Monday, 2 June 2014 at 23:44:01 UTC, Rene Zwanenburg wrote: On Monday, 2 June 2014 at 20:09:12 UTC, Edwin van Leeuwen wrote: As you may have guessed, a workaround is to copy the iteration variable yourself: unittest {

Re: Delegate, scope and associative array

2014-06-03 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Tuesday, 3 June 2014 at 07:00:35 UTC, Ali Çehreli wrote: Here is a workaround: unittest { size_t delegate()[size_t] events; auto makeClosure(size_t i) { return { return i; }; } foreach( i; 1..4 ) { events[i] = makeClosure(i); } assert( events[1]()

Re: D JSON (WAT?!)

2014-07-24 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 24 July 2014 at 15:42:58 UTC, Pavel wrote: On Thursday, 24 July 2014 at 15:38:06 UTC, John Colvin wrote: On Thursday, 24 July 2014 at 15:32:29 UTC, John Colvin wrote: On Thursday, 24 July 2014 at 15:15:37 UTC, Pavel wrote: Ok, let me start with the sample code: import std.stdio;

Re: DUB: link to local library

2014-09-10 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Wednesday, 10 September 2014 at 13:40:16 UTC, rcor wrote: dub.json contains what I think should do the same as above: { name: test, importPaths: [ext/dallegro5], lflags: [-Lext/dallegro5] } Does adding: libs: [dallegro5] make a difference? Cheers, Edwin

Re: Recomended cairo bindings

2014-09-15 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 15 September 2014 at 12:11:09 UTC, Paul Z. Barsan wrote: On Sunday, 14 September 2014 at 14:37:05 UTC, Robert burner Schadek wrote: If you look at deimos.cairo you will see that the latest commit was made 2 years ago while cairoD was last updated 6 months ago. I think the latest

Using return type of a predicate function as a template

2014-10-16 Thread Edwin van Leeuwen via Digitalmars-d-learn
I am trying to implement a groupBy function that groups by the return type of a predicate. Currently I have to define the returntype of the predicate for it to compile. Is there a way to get the return type at compile time and use it. The code: V[K] groupBy( alias func, K, V )( V values ) {

Re: Using return type of a predicate function as a template

2014-10-16 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 16 October 2014 at 08:18:02 UTC, Atila Neves wrote: This works: import std.range; auto groupBy(alias func, R)(R values) if (isInputRange!R) { alias K = typeof(func(values.front)); alias V = ElementType!R[]; V[K] grouped; foreach(value; values)

Re: Indivisual Incremental Compalation with dub

2015-08-13 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 13 August 2015 at 05:42:38 UTC, Freddy wrote: I have a file that takes a while to compile with a static interface. Is there any way i can make dub keep the object file of only that file(for faster compilation)? I don't think dub itself can do this, but

Re: Compiletime Vs Runtime bencmarks

2015-08-17 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 17 August 2015 at 14:43:35 UTC, D_Learner wrote: Hello everyone . I need advice on my first D-project . I have uploaded it at :- Current Results for the pattern=GCAGAGAG are as below :- BM_Runtime = 366 hnsecs position= 513 BM_Compile-time = 294 hnsecs

Re: (De)Serializing interfaces

2015-08-24 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 24 August 2015 at 09:26:40 UTC, Edwin van Leeuwen wrote: On Saturday, 22 August 2015 at 19:14:16 UTC, nims wrote: Painlessjson indeed does not support interfaces/subclasses at the moment. There was some discussion about it here: https://github.com/BlackEdder/painlessjson/issues/8 ,

Re: (De)Serializing interfaces

2015-08-24 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Saturday, 22 August 2015 at 19:14:16 UTC, nims wrote: I think interfaces are very powerful and I heavily use them. The only problem I have with them is that serializing/deserializing them to XML or JSON doesn't seem to work. So far I got to try Orange and painlessjson. Using Orange all I

Re: dub and subpackages

2015-08-14 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 14 August 2015 at 08:06:15 UTC, yawniek wrote: i'm trying to have my own versions of my dependencies as git submodules. whats the correct way of having a chain of packages included from git submodules so that every packages get's only picked once? dub add-local allows you to

Re: Merging two named Tuples

2015-10-29 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Saturday, 24 October 2015 at 11:04:14 UTC, Edwin van Leeuwen wrote: I am trying to write a function to merge two named structs, but am completely stuck on how to do that and was wondering if anyone good provide any help. I know I can access the different names with tup.fieldNames, but

Re: Merging two named Tuples

2015-10-29 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 29 October 2015 at 19:42:10 UTC, anonymous wrote: `tup` is an ordinary (run time, dynamic) string to the type system. You can't mixin those. You can only mixin static values (enum, static immutable, CTFE results). The code you're generating doesn't depend on `base` and `other`.

Merging two named Tuples

2015-10-24 Thread Edwin van Leeuwen via Digitalmars-d-learn
I am trying to write a function to merge two named structs, but am completely stuck on how to do that and was wondering if anyone good provide any help. I know I can access the different names with tup.fieldNames, but basically can't work out how to use that to build the new return type. Below

Re: my first D program (and benchmark against perl)

2015-11-11 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Wednesday, 11 November 2015 at 13:32:00 UTC, perlancar wrote: for (int rownum=0; rownum < table.length; rownum++) { res ~= "|"; for (int colnum=0; colnum < table[rownum].length; colnum++) { res ~= leftJustify(table[rownum][colnum], widths[colnum]);

Re: foreach loop

2015-11-03 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 15:29:31 UTC, Namal wrote: writefln("Count is: %s", arr .filter!(a => a==true) .sum); // Note: std.algorithm.sum is the same as // std.algorithm.reduce!((a,b)=a+b); Shouldn't you be using walkLength instead of sum, since you are counting the left over

Re: foreach loop

2015-11-03 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 16:55:44 UTC, wobbles wrote: On Tuesday, 3 November 2015 at 15:42:16 UTC, Edwin van Leeuwen wrote: On Tuesday, 3 November 2015 at 15:29:31 UTC, Namal wrote: writefln("Count is: %s", arr .filter!(a => a==true) .sum); // Note: std.algorithm.sum is the same as

Re: Idiomatic adjacent_difference

2015-10-16 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 16 October 2015 at 11:43:16 UTC, Guillaume Chatelet wrote: On Friday, 16 October 2015 at 11:38:35 UTC, John Colvin wrote: Nice ! I wanted to use lockstep(r, r.dropOne) but it doesn't return a Range :-/ It has to be used in a foreach. Instead of lockstep you can always use zip

Frequent cannot deduce function from argument types

2015-10-16 Thread Edwin van Leeuwen via Digitalmars-d-learn
Just wondering if anyone has any tips on how to solve/avoid "cannot deduce function from argument types" when relying on template programming. I run into these problems all the time. Current one was when I tried: ``` auto ys = NumericLabel(groupedAes.front.map!((t)=>t.y)); ``` NumericLabel

Re: reading file byLine

2015-09-04 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 4 September 2015 at 12:06:08 UTC, Edwin van Leeuwen wrote: On Friday, 4 September 2015 at 11:50:23 UTC, deed wrote: import std.algorithm, std.range, std.array, std.string, std.stdio, std.conv; int[] arr1 = [1, 2, 30]; //arr1.max.writeln; // Doesn't work, as you say

Re: reading file byLine

2015-09-04 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 4 September 2015 at 11:50:23 UTC, deed wrote: import std.algorithm, std.range, std.array, std.string, std.stdio, std.conv; int[] arr1 = [1, 2, 30]; //arr1.max.writeln; // Doesn't work, as you say arr1.reduce!max.writeln;// This does. Prints 30. Again using reduce is

Re: Parameterized unittests and benchmarks (aka quickfix + benchmark) PR 2995

2015-09-08 Thread Edwin van Leeuwen via Digitalmars-d
On Wednesday, 2 September 2015 at 08:30:40 UTC, Robert burner Schadek wrote: Everybody is talking about benchmarks and making code faster, yet phobos is still lacking any long term benchmark gathering and monitoring solution. PR https://github.com/D-Programming-Language/phobos/pull/2995

Re: Parameterized unittests and benchmarks (aka quickfix + benchmark) PR 2995

2015-09-08 Thread Edwin van Leeuwen via Digitalmars-d
On Tuesday, 8 September 2015 at 09:01:22 UTC, Robert burner Schadek wrote: On Tuesday, 8 September 2015 at 08:42:59 UTC, Edwin van Leeuwen wrote: This does sound like a really good idea. Is the plan to turn every unittest block into a benchmark (automatically), or did you add specific

Re: What is "FilterResult" type?

2015-09-08 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 11:08:59 UTC, Bahman Movaqar wrote: On Tuesday, 8 September 2015 at 10:08:03 UTC, cym13 wrote: Filter is a template and returns a FilterResult range which is used to lazily compute the result. This behaviour is the same for map and the majority of functions in

Re: Compile all-of-dub?

2015-09-09 Thread Edwin van Leeuwen via Digitalmars-d
On Wednesday, 9 September 2015 at 08:56:56 UTC, Rikki Cattermole wrote: On 09/09/15 8:26 PM, qznc wrote: The Rust people have this Crater [0,1] tool, which essentially builds all Rust libraries with two compiler versions and compares for regressions. Since D has a central library repository

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 14 September 2015 at 12:50:03 UTC, Fredrik Boulund wrote: On Monday, 14 September 2015 at 12:44:22 UTC, Edwin van Leeuwen wrote: Sounds like this program is actually IO bound. In that case I would not expect a really expect an improvement by using D. What is the CPU usage like when

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund wrote: Hi, Using a small test file (~550 MB) on my machine (2x Xeon(R) CPU E5-2670 with RAID6 SAS disks and 192GB of RAM), the D version runs in about 20 seconds and the Python version less than 16 seconds. I've repeated runs at

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:54:34 UTC, Fredrik Boulund wrote: On Monday, 14 September 2015 at 14:40:29 UTC, H. S. Teoh wrote: I agree with you on that. I used Python's cProfile module to find the performance bottleneck in the Python version I posted, and shaved off 8-10 seconds of

Re: New blog about D

2015-09-28 Thread Edwin van Leeuwen via Digitalmars-d-announce
On Sunday, 27 September 2015 at 23:23:05 UTC, Márcio Martins wrote: The blog platform itself is home-made and the server-side is 100% D (vibe.d). Once I build it up a bit more, I will probably put it up on github as an example of how easy it is to build high-performance frontend and backend

Re: Dub package with C code

2015-09-24 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 24 September 2015 at 06:21:02 UTC, Sebastiaan Koppe wrote: Because I want to focus on the product I am building right now, not on side-projects. You could try including the c source in your repo and add preBuildCommands to the dub config which builds the static library.

Re: ORM libraries for D

2015-09-24 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 24 September 2015 at 13:24:14 UTC, Rikki Cattermole wrote: Dvorm is more or less feature complete :) I am the author of it, but unless issues come up I do not intend to continue working upon it. You could consider bumping it up to version 1.0.0 to highlight this.

Re: reading file byLine

2015-09-18 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 18 September 2015 at 10:48:25 UTC, Namal wrote: On Friday, 18 September 2015 at 10:34:41 UTC, Edwin van Leeuwen wrote: On Friday, 18 September 2015 at 10:26:46 UTC, Namal wrote: Hello guys, is there a nice functional way to read the file which is like 1,2,3,4,5,6 2,3,4,5,6,7

Re: reading file byLine

2015-09-18 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 18 September 2015 at 10:26:46 UTC, Namal wrote: Hello guys, is there a nice functional way to read the file which is like 1,2,3,4,5,6 2,3,4,5,6,7 8,9,0,9,2,3 line by line, split numbers and remove each ',' convert it to int and save in a matrix int[][] arr? Not tested, but I

Re: reading file byLine

2015-09-18 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 18 September 2015 at 12:28:29 UTC, Namal wrote: So do I understand it right: does => in map! indicates a lambda function? Yes exactly. There are a number of ways you can define a lambda function in D. For example if the function is multiline I often use: (l) { ...; // do

Re: CMake support for D

2016-01-04 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 4 January 2016 at 12:40:23 UTC, Dibyendu Majumdar wrote: Thanks for suggesting dub, will check it out. Also premake seems to support D so that is another option. Another alternative is reggae which supports mixed code base: https://github.com/atilaneves/reggae and can generate

Re: Beta release DUB 1.0.0-beta.1

2016-06-07 Thread Edwin van Leeuwen via Digitalmars-d-announce
On Tuesday, 7 June 2016 at 09:54:19 UTC, Sönke Ludwig wrote: DUB 1.0.0 is nearing completion. The new feature over 0.9.25 is support for single-file packages, which can be used to write shebang-style scripts on Posix systems: #!/usr/bin/env dub /++ dub.sdl: name "colortest"

Re: Button: A fast, correct, and elegantly simple build system.

2016-06-15 Thread Edwin van Leeuwen via Digitalmars-d-announce
On Monday, 13 June 2016 at 00:27:47 UTC, Walter Bright wrote: On 5/30/2016 12:16 PM, Jason White wrote: Here is an example build description for DMD: https://github.com/jasonwhite/dmd/blob/button/src/BUILD.lua I'd say that's a lot easier to read than this crusty thing:

Re: Button: A fast, correct, and elegantly simple build system.

2016-06-15 Thread Edwin van Leeuwen via Digitalmars-d-announce
On Wednesday, 15 June 2016 at 15:39:47 UTC, Andrei Alexandrescu wrote: On 06/15/2016 08:05 AM, John Colvin wrote: On Wednesday, 15 June 2016 at 11:47:00 UTC, Walter Bright wrote: On 6/15/2016 4:07 AM, Edwin van Leeuwen wrote: How about using reggae?

Re: mir.random - my GSoC project

2016-06-02 Thread Edwin van Leeuwen via Digitalmars-d
On Thursday, 2 June 2016 at 10:56:36 UTC, Martin Nowak wrote: On 04/23/2016 04:17 PM, Seb wrote: This project is about adding non-uniform random generators to mir and hopefully eventually to Phobos. I just happen to need a gaussian random number generator right now. Is there already some WIP

Re: Garbage Collector

2016-06-15 Thread Edwin van Leeuwen via Digitalmars-d
On Wednesday, 15 June 2016 at 17:03:21 UTC, Konstantin wrote: On Wednesday, 15 June 2016 at 13:56:09 UTC, Jack Stouffer wrote: Has anyone thought about taking GC from .NET and reusing it in D? Two words: write barriers. What about them? You mean not all D’s target platforms support them? I

Re: String joining an array of structs or class instances implementing toString?

2016-02-11 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 11 February 2016 at 12:44:15 UTC, pineapple wrote: It feels like there should be an out-of-the box way to do this but I haven't been able to find it? Help? This is the thing that I want to do: struct example{ const string str; //this(string str){ this.str = str; }

Re: Wannabe contributor frustrations

2016-02-11 Thread Edwin van Leeuwen via Digitalmars-d
On Thursday, 11 February 2016 at 07:31:10 UTC, Daniel Kozak wrote: Dne 11.2.2016 v 08:23 Jonathan M Davis via Digitalmars-d napsal(a): On Thursday, 11 February 2016 at 06:57:39 UTC, Daniel Kozak wrote: Dne 11.2.2016 v 01:20 Adam D. Ruppe via Digitalmars-d napsal(a): IMO it is a denial of

Re: String joining an array of structs or class instances implementing toString?

2016-02-11 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 11 February 2016 at 13:43:49 UTC, pineapple wrote: Thanks! Does the map function iterate without constructing an extra list in-memory? Yes, it is lazy, so it only calls toString when the result is actually used (by the join call). In case you do need to create an extra list

Re: reduce -> fold?

2016-01-29 Thread Edwin van Leeuwen via Digitalmars-d
On Friday, 29 January 2016 at 16:38:23 UTC, Brad Anderson wrote: And just for completeness, here is monarchdodra's valiant but ultimately unsuccessful pull request which attempted fix reduce: https://github.com/D-Programming-Language/phobos/pull/861#issuecomment-20760448 Interestingly, that

Re: Is DUB the best place to get examples of "Best of" D code?

2016-02-28 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Sunday, 28 February 2016 at 05:59:39 UTC, WhatMeWorry wrote: If so, is there a way to do a global search of all projects in DUB? If you just want to search through package names and descriptions you can use the search box at the top right of code.dlang.org. If you want to search

Re: Am I right understand the dub.json system?

2016-02-29 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 29 February 2016 at 12:27:04 UTC, Suliman wrote: For example I have got app that depended on DDBC. In configuration section DDBC related on: "libs-posix": [ "sqlite3", "pq" ] Does it's mean that it will try to find this 2 libs in any case? Even I do not use them. If I do not

Re: Am I right understand the dub.json system?

2016-02-29 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 29 February 2016 at 12:45:36 UTC, Suliman wrote: On Monday, 29 February 2016 at 12:34:02 UTC, Edwin van Leeuwen wrote: Should it be like this? http://www.everfall.com/paste/id.php?80k9jsgdx6o3 "versions": ["VibeCustomMain"], "versions": ["USE_MYSQL"], As far as I know all

Re: Why file.exists of relative path on Linux always return false?

2016-02-29 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 29 February 2016 at 14:58:46 UTC, Alex Parrill wrote: On Monday, 29 February 2016 at 14:50:51 UTC, Suliman wrote: I am trying to check relative path on Linux for exists. string mypath = "~/Documents/imgs"; ~ is expanded by your shell. It is not a relative path, and system calls

Re: Speed of csvReader

2016-01-21 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 21 January 2016 at 09:39:30 UTC, data pulverizer wrote: StopWatch sw; sw.start(); auto buffer = std.file.readText("Acquisition_2009Q2.txt"); auto records = csvReader!row_type(buffer, '|').array; sw.stop(); Is it csvReader or readText that is slow? i.e. could you move

Re: Speed of csvReader

2016-01-21 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 21 January 2016 at 15:17:08 UTC, data pulverizer wrote: On Thursday, 21 January 2016 at 14:56:13 UTC, Saurabh Das wrote: @Edwin van Leeuwen The csvReader is what takes the most time, the readText takes 0.229 s The underlying problem most likely is that csvReader has (AFAIK)

Re: Speed of csvReader

2016-01-22 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 22 January 2016 at 02:16:14 UTC, H. S. Teoh wrote: On Thu, Jan 21, 2016 at 04:50:12PM -0800, H. S. Teoh via Digitalmars-d-learn wrote: [...] > > https://github.com/quickfur/fastcsv [...] Fixed some boundary condition crashes and reverted doubled quote handling in unquoted

Re: extern(C++, ns)

2016-01-20 Thread Edwin van Leeuwen via Digitalmars-d
On Wednesday, 20 January 2016 at 12:47:44 UTC, Manu wrote: No, I really *really* didn't. It seems I have a habit of being completely misunderstood. Just for your information, I understand what you mean Manu :) (and agree with you). I guess it might be helpful if you could spell out (in

Re: Any actively maintained qt bindings for D?

2016-02-18 Thread Edwin van Leeuwen via Digitalmars-d
On Wednesday, 17 February 2016 at 20:56:27 UTC, Rishub Nagpal wrote: Qtd hasn't been updated in 3 years Does anyone know of anactively maintained qt library? Calypso apparently makes it (partly) possible to call Qt from D.

Re: Normal distribution

2016-02-20 Thread Edwin van Leeuwen via Digitalmars-d
On Saturday, 20 February 2016 at 14:01:22 UTC, Andrei Alexandrescu wrote: Do we have a good quality converter of uniform numbers to Gaussian-distributed numbers around? -- Andrei There is one in dstats: https://github.com/DlangScience/dstats/blob/master/source/dstats/random.d#L266

Re: Installing DUB on OSX

2016-02-18 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 18 February 2016 at 09:25:00 UTC, Joel wrote: On Thursday, 18 February 2016 at 08:24:34 UTC, Jacob Carlborg wrote: On 2016-02-18 08:11, Joel wrote: I had dub installed in a folder that meant I had to put 'sudo dub' to run it. I've tried to fix the problem, but where do you put it

Updated plotcli (version 0.8.0). Now build on ggplotd

2016-02-15 Thread Edwin van Leeuwen via Digitalmars-d-announce
Plotcli[1] is a command line application that can create plots by parsing text/csv files and from piped data, making it useful during data analysis. Plotcli v0.8.0 has been largely rewritten to use ggplotd[2] as its backend. This results in more beautiful plots and gives us greater control

Re: Updated plotcli (version 0.8.0). Now build on ggplotd

2016-02-15 Thread Edwin van Leeuwen via Digitalmars-d-announce
On Monday, 15 February 2016 at 20:17:00 UTC, wobbles wrote: This looks very cool - does it take long to export the png file? Particularly with the -f flag, if the data file is updated, how long until does it take to print? I know I could check, but you prob know the answer :P Currently it

Re: Updated plotcli (version 0.8.0). Now build on ggplotd

2016-02-15 Thread Edwin van Leeuwen via Digitalmars-d-announce
On Monday, 15 February 2016 at 22:54:19 UTC, wobbles wrote: Sounds good! I have a vibe.d app that plots our servers sar data using plotly.js. I'll investigate integrating this instead of plotly so I'll have a fully D solution! (I tried generating my own svg file but it was too large an

Re: Obtaining argument names in (variadic) functions

2016-03-18 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 17 March 2016 at 13:53:00 UTC, JR wrote: Interesting, any idea if it is possible to do assignment within template.. Either: printVars!(int abc=5,string def="58")(); or something like printVars!("abc","def",ghi)(5,"58"); What would the use-cases for those be? I don't think the

Re: Named arguments via struct initialization in functions

2016-03-08 Thread Edwin van Leeuwen via Digitalmars-d
On Sunday, 6 March 2016 at 17:35:38 UTC, Seb wrote: Hey all, Using structs is not ideal, because one can't require parameters, but this can be solved by having those parameters as normal ones like `sliced(4, {allowDownsize: true})` and it creates some maybe unnecessary overhead. However it

Re: Named arguments via struct initialization in functions

2016-03-08 Thread Edwin van Leeuwen via Digitalmars-d
On Wednesday, 9 March 2016 at 07:30:31 UTC, Edwin van Leeuwen wrote: I also added a merge function that will return a tuple containing merged named tuples: Tuple!(double,"x",string,"colour")(-1, "black").merge(Tuple!(double,"x")(0.0)) returns: Tuple!(double,"x",string,"colour")(0, "black");

Re: How to sort a range

2016-03-09 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 13:04:31 UTC, rcorre wrote: On Wednesday, 9 March 2016 at 12:31:18 UTC, Edwin van Leeuwen wrote: On Wednesday, 9 March 2016 at 12:21:55 UTC, rcorre wrote: If you are looking for a lazy uniq that works on non sorted ranges, I implemented one not to long ago:

Re: How to sort a range

2016-03-09 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 12:21:55 UTC, rcorre wrote: If you are looking for a lazy uniq that works on non sorted ranges, I implemented one not to long ago: http://github.com/BlackEdder/ggplotd/blob/master/source/ggplotd/range.d That sounds like the kind of thing I was looking for. I'll

Re: How to sort a range

2016-03-09 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 15:39:55 UTC, rcorre wrote: On Wednesday, 9 March 2016 at 14:28:11 UTC, cym13 wrote: Still curious as to why it fails; maybe the range is getting copied at some point? I guess I need to step through it. I did try different SwapStrategies with no luck. Since

Re: dmd-built dmd is faster that ldc-built dmd or gdc-built dmd?

2016-03-11 Thread Edwin van Leeuwen via Digitalmars-d
On Friday, 11 March 2016 at 14:46:59 UTC, Vladimir Panteleev wrote: Thanks :) After changing that to version(all), LDC is faster now. Doesn't build with GDC though (multiple definitions)... How much faster is LDC?

Re: Obtaining argument names in (variadic) functions

2016-03-19 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Wednesday, 16 March 2016 at 20:53:42 UTC, JR wrote: void printVars(Args...)() if (Args.length > 0) { import std.stdio : writefln; foreach (i, arg; Args) { writefln("%s\t%s:\t%s", typeof(Args[i]).stringof, Args[i].stringof, arg); } } void main() { int abc = 3;

Re: how to parse a string into a phobos datatype with additional logic

2016-04-07 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 7 April 2016 at 07:45:06 UTC, yawniek wrote: what is the way one is supposed to parse e.g. a double of unixtime (as delived by nginx logs) into a SysTime? currently i'm creating a wrapper struct around SysTime with alias this as:

Re: is std.algorithm.joiner lazy?

2016-04-07 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 7 April 2016 at 07:07:40 UTC, Puming wrote: Hi: when I use map with joiner, I found that function in map are called. In the document it says joiner is lazy, so why is the function called? say: int[] mkarray(int a) { writeln("mkarray called!"); return [a * 2]; // just for

Re: is std.algorithm.joiner lazy?

2016-04-07 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 7 April 2016 at 08:17:38 UTC, Puming wrote: On Thursday, 7 April 2016 at 08:07:12 UTC, Edwin van Leeuwen wrote: OK. Even if it consumes the first two elements, then why does it have to consume them AGAIN when actually used? If the function mkarray has side effects, it could lead

Re: Official dub packages for Debian and Ubuntu

2016-04-11 Thread Edwin van Leeuwen via Digitalmars-d-announce
On Monday, 11 April 2016 at 14:21:46 UTC, Matthias Klumpp wrote: And porting Python code to D was incredibly easy. I'll likely blog about my experience with D). That would be great. Do you have a link to your blog (and its rss feed)? As part of that work, the dub package an build management

Re: Command line utilities for tab-separated value files

2016-04-12 Thread Edwin van Leeuwen via Digitalmars-d-announce
On Tuesday, 12 April 2016 at 07:17:05 UTC, Jon D wrote: I'd certainly like to make it available via dub, but I wasn't sure how to set it up. There are two issues. One is that the package builds multiple executables, which dub doesn't seem to support easily. More problematic is that quite a

Re: simple range question

2016-04-08 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 8 April 2016 at 18:27:59 UTC, Laeeth Isharc wrote: suppose I have a forward or random access range. what's the best way to compare each element with the element 4 elements prior to that element? I could map each element to a tuple of the element and the element 4 bars previously

Re: is std.algorithm.joiner lazy?

2016-04-07 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 7 April 2016 at 09:55:56 UTC, Puming wrote: When compiled, I get the error: Error: open path skips field __caches_field_0 source/app.d(19, 36): Error: template instance std.algorithm.iteration.cache!(MapResult!(__lambda1, int[])) error instantiating That seems like a bug to me

Re: Gdmd compiling error

2016-03-19 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Wednesday, 16 March 2016 at 12:17:42 UTC, Orkhan wrote: On Tuesday, 15 March 2016 at 18:26:48 UTC, Ali Çehreli wrote: I don't know where from shpuld I get help. Thanks. Is the xcomm library available somewhere, maybe if we had a link to the original documentation we could help.

Re: Some crazy ideas from a high level perspective

2016-03-22 Thread Edwin van Leeuwen via Digitalmars-d
On Tuesday, 22 March 2016 at 15:19:10 UTC, rikki cattermole wrote: Idea 1: Sigh I do wish the author of gl3n had given permission for relicense for Phobos. Would do what you want. Idea 3: My goal is get windowing/image library into Phobos. Now that is not a UI toolkit but you can atleast

Re: Some crazy ideas from a high level perspective

2016-03-22 Thread Edwin van Leeuwen via Digitalmars-d
On Tuesday, 22 March 2016 at 15:50:15 UTC, Basile B. wrote: On Tuesday, 22 March 2016 at 15:33:04 UTC, Edwin van Leeuwen wrote: On Tuesday, 22 March 2016 at 15:19:10 UTC, rikki cattermole wrote: Idea 1: Sigh I do wish the author of gl3n had given permission for relicense for Phobos. Would do

Re: Usage of custom class with JSONValue

2016-03-24 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 24 March 2016 at 11:39:13 UTC, arturg wrote: isnt alias this supposed to do this implicitly? convert this auto jsValue = JSONValue(new MyClass()); into this auto jsValue = JSONValue((new MyClass())._data); Good point, I did not catch that. That indeed should work and seems to

Re: iota result as member variable

2016-03-24 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 24 March 2016 at 06:54:25 UTC, Alex wrote: Hi everybody, doing some optimization on my code, I faced some strange question: how to save a iota result in a class member? Say I have class A { ??? member; auto testIter4() { return iota(0,5); } } void main()

Re: Usage of custom class with JSONValue

2016-03-24 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 24 March 2016 at 08:15:12 UTC, Andre wrote: Hi, I have a class which has already an alias this to a string array, so I can use it in a foreach loop. class MyClass { string[] _data; alias _data this; // ... } void main() { import std.json;

Re: Memory Efficient HashSet

2016-03-08 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 08:12:04 UTC, Nordlöw wrote: Has anybody put together a memory-efficient D-implementation of a HashSet Something like sparse_hash_set<> contained in https://github.com/sparsehash/sparsehash but in D. There is an implementation in:

Re: Warning: statement is not reachable

2016-03-02 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Tuesday, 1 March 2016 at 21:30:44 UTC, Tamas wrote: foreach(attr; __traits(getAttributes, S)) { static if (is(attr == Tag)) { return true; } } return false; }(); } void main() { static @Tag struct

Re: Warning: statement is not reachable

2016-03-02 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Tuesday, 1 March 2016 at 21:30:44 UTC, Tamas wrote: My d code doesn't compile using ldc2 1.0.0-alpha or anything above DMD v2.068.0 Using these compilers I get a lot of "Warning: statement is not reachable". Then the both compiler crashes. ldc2 -w reach.d dmd -w reach.d reach.d:

Re: How to sort a range

2016-03-09 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 03:05:52 UTC, rcorre wrote: I was in a situation where I wanted to remove duplicates from an OnlyResult. To do this with uniq, I needed to sort it. OnlyResult doesn't satisfy the template constraints of sort, but this seems easy enough to fix. I made front, back,

Re: Read only delegate

2016-04-04 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 4 April 2016 at 11:32:23 UTC, Rene Zwanenburg wrote: On Monday, 4 April 2016 at 08:10:10 UTC, Edwin van Leeuwen wrote: Is there a way to make sure a delegate only reads state, without changing it? I tried annotating the delegate as const, but that does not seem to work. ``` Yeah

Re: Read only delegate

2016-04-04 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 4 April 2016 at 08:10:10 UTC, Edwin van Leeuwen wrote: Is there a way to make sure a delegate only reads state, without changing it? I tried annotating the delegate as const, but that does not seem to work. Note that annotating with pure also doesn't help. As a result we can

Re: Read only delegate

2016-04-04 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 4 April 2016 at 11:39:55 UTC, Kagamin wrote: On Monday, 4 April 2016 at 11:32:23 UTC, Rene Zwanenburg wrote: https://issues.dlang.org/show_bug.cgi?id=1983 Bug 1983 is about usage of delegates after creation, restrictions during creation are enforced. AIU, OP wants to have const

Re: infer type argument in classe constructor?

2016-03-29 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Tuesday, 29 March 2016 at 10:13:28 UTC, Puming wrote: Hi, I'm writing a generic class: ```d struct Message { ... } class Decoder(MsgSrc) { } ``` When using it, I'd have to include the type of its argument: ``` void main() { Message[] src = ...; auto decoder = new

Read only delegate

2016-04-04 Thread Edwin van Leeuwen via Digitalmars-d-learn
Is there a way to make sure a delegate only reads state, without changing it? I tried annotating the delegate as const, but that does not seem to work. ```D void main() { import std.stdio : writeln; auto r = [0,1,2,3]; auto f = delegate() const // Compiles even though we are

Re: Something wrong with GC

2016-03-22 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Tuesday, 22 March 2016 at 13:46:41 UTC, stunaep wrote: public class Example2 { private int one; private int two; public this(int one, int two) { this.one = one; this.two = two; } } in a tree map and list of

Re: Computer Vision Library in D

2016-04-28 Thread Edwin van Leeuwen via Digitalmars-d-announce
On Thursday, 28 April 2016 at 11:32:25 UTC, Michael wrote: And I would also like to see some more scientific libraries make it into D. Though I understand that including it in the standard library can cause issues, it would be nice to at least get some Linear Algebra libraries in experimental

Re: matrix library

2016-05-23 Thread Edwin van Leeuwen via Digitalmars-d-announce
On Monday, 23 May 2016 at 20:27:54 UTC, Vlad Levenfeld wrote: On Monday, 23 May 2016 at 20:11:22 UTC, Vlad Levenfeld wrote: ... On first glance it looks like https://github.com/DlangScience/scid/blob/master/source/scid/matrix.d has most of what my matrix implementation is missing. Not sure

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-18 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Wednesday, 18 May 2016 at 16:37:48 UTC, TheDGuy wrote: On Wednesday, 18 May 2016 at 16:13:35 UTC, Seb wrote: May I ask why you need to get tango working? It has been deprecated a long time ago and phobos (the standard library) or alternatively other packages on dub have a look of features

Re: static member and/or @property ?

2016-05-19 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 19 May 2016 at 15:04:00 UTC, chmike wrote: The only viable solution I found so far is by using distinct member names. In the interface we define name as a property, and in the class we define the static member with another name. Is it possible to avoid the different names ? Can

Re: static member and/or @property ?

2016-05-19 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 19 May 2016 at 15:12:44 UTC, Edwin van Leeuwen wrote: On Thursday, 19 May 2016 at 15:04:00 UTC, chmike wrote: The only viable solution I found so far is by using distinct member names. In the interface we define name as a property, and in the class we define the static member with

  1   2   >