Re: How to work with and load/save sparse compressed matrices? (numir, mir.sparse)

2020-10-04 Thread 9il via Digitalmars-d-learn
On Tuesday, 29 September 2020 at 04:52:11 UTC, Shaleen Chhabra wrote: I wish to use load / save for sparse compressed matrices using mir. import mir.sparse; auto sp = sparse!double(5, 8); auto crs = sp.compress; How can I save/load sparse compressed arrays in `npz` format?

Re: QuickSort on ranges

2020-10-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/4/20 6:50 AM, jerome wrote: Thanks you very much Ali, I will try to wrap my head around your inputs, and get a better understanding of ranges in the process. I feel there is a lot of power in D ranges, and like the hammer of Thor, I am not worthy yet :) Just to elaborate a bit

Re: Taking arguments by value or by reference

2020-10-04 Thread Max Haughton via Digitalmars-d-learn
On Sunday, 4 October 2020 at 14:26:43 UTC, Anonymouse wrote: On Saturday, 3 October 2020 at 23:47:32 UTC, Max Haughton wrote: The guiding principle to your function parameters should be correctness - if I am passing a big struct around, if I want to take ownership of it I probably want to take

Re: Dub build failure

2020-10-04 Thread jerome via Digitalmars-d-learn
On Sunday, 4 October 2020 at 20:25:48 UTC, Andre Pany wrote: On Sunday, 4 October 2020 at 18:45:34 UTC, jerome wrote: I am trying to compile a simple lib, and a simple demo using this lib. [...] If I am not wrong there is following issue: in D a package is a folder. Having the package.d

Re: dub fetching dependencies for wrong configuration(s)

2020-10-04 Thread ikod via Digitalmars-d-learn
On Sunday, 4 October 2020 at 20:08:31 UTC, Andre Pany wrote: On Sunday, 4 October 2020 at 14:08:24 UTC, Anonymouse wrote: At the moment the only chance to avoid these additional dependencies would be to split requests into 2 dub packages. The core package which uses std, and an additional

Re: Taking arguments by value or by reference

2020-10-04 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 4 October 2020 at 15:30:48 UTC, IGotD- wrote: I don't agree with this, especially if the struct is 432 bytes. It takes time and memory to copy such structure. If the compiler chooses to inline the function (which happens quite frequently with optimizations turned on), no copy takes

Re: Dub build failure

2020-10-04 Thread Andre Pany via Digitalmars-d-learn
On Sunday, 4 October 2020 at 18:45:34 UTC, jerome wrote: I am trying to compile a simple lib, and a simple demo using this lib. [...] If I am not wrong there is following issue: in D a package is a folder. Having the package.d file as child of folder source is not correct. Moving the file

Re: dub fetching dependencies for wrong configuration(s)

2020-10-04 Thread Andre Pany via Digitalmars-d-learn
On Sunday, 4 October 2020 at 14:08:24 UTC, Anonymouse wrote: My project depends on the requests dub package, which has two build configurations; one with an extra vibe-d dependency, one without (default). "configurations": [ { "name": "std" }, {

Learn D while updating Rosetta code

2020-10-04 Thread Imperatorn via Digitalmars-d-learn
Just a tip to everyone. If you're trying to learn D, you can try to implement some of these missing tasks and update the corresponding page: http://rosettacode.org/wiki/Reports:Tasks_not_implemented_in_D

Dub build failure

2020-10-04 Thread jerome via Digitalmars-d-learn
I am trying to compile a simple lib, and a simple demo using this lib. So I have 2 directories at the same level in the same DEV directory: demo1 Dterrent In the Dterrent directory, the dub.json is pretty common, compiling as a lib: "name": "dterrent",

Re: cannot call impure function

2020-10-04 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 4 October 2020 at 18:02:11 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:43:13 UTC, Michael wrote: [...] I used the dmg file: dmd.2.094.0.dmg I reinstalled using the installation script (install.sh) and now it works. Still don't know why the dmg-based intstallation did not

Re: cannot call impure function

2020-10-04 Thread Michael via Digitalmars-d-learn
On Sunday, 4 October 2020 at 17:43:13 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:37:52 UTC, Mathias LANG wrote: On Sunday, 4 October 2020 at 17:05:33 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote: On Sunday, 4 October 2020 at 16:48:24 UTC, Michael

Re: cannot call impure function

2020-10-04 Thread Michael via Digitalmars-d-learn
On Sunday, 4 October 2020 at 17:37:52 UTC, Mathias LANG wrote: On Sunday, 4 October 2020 at 17:05:33 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote: On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid

Re: cannot call impure function

2020-10-04 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid question, but I'm a complete newbie to D. Why does compiling the following trivial code fail? [...] I have tried my best to make it fail, but can't. Maybe it's something with the

Re: cannot call impure function

2020-10-04 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 4 October 2020 at 17:05:33 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote: On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid question, but I'm a complete newbie to D. Why does compiling the

Re: cannot call impure function

2020-10-04 Thread Michael via Digitalmars-d-learn
On Sunday, 4 October 2020 at 17:05:33 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote: On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid question, but I'm a complete newbie to D. Why does compiling the

Re: cannot call impure function

2020-10-04 Thread Michael via Digitalmars-d-learn
On Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote: On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid question, but I'm a complete newbie to D. Why does compiling the following trivial code fail? import std.stdio; void main() {

Re: cannot call impure function

2020-10-04 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid question, but I'm a complete newbie to D. Why does compiling the following trivial code fail? import std.stdio; void main() { writeln(3.14); } Works fine for me using DMD 2.094.0 on

cannot call impure function

2020-10-04 Thread Michael via Digitalmars-d-learn
Dear all, Sorry for the potentially stupid question, but I'm a complete newbie to D. Why does compiling the following trivial code fail? import std.stdio; void main() { writeln(3.14); } Error message: /Library/D/dmd/src/phobos/std/format.d(1601): Error: pure function

Re: Taking arguments by value or by reference

2020-10-04 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 4 October 2020 at 14:26:43 UTC, Anonymouse wrote: [...] I mostly really only want a read-only view of the struct, and whether a copy was done or not is academic. However, profiling showed (what I interpret as) a lot of copying being done in release builds specifically.

Re: Taking arguments by value or by reference

2020-10-04 Thread IGotD- via Digitalmars-d-learn
On Saturday, 3 October 2020 at 23:00:46 UTC, Anonymouse wrote: I'm passing structs around (collections of strings) whose .sizeof returns 432. The readme for 2.094.0 includes the following: This release reworks the meaning of in to properly support all those use cases. in parameters will now

Re: Taking arguments by value or by reference

2020-10-04 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 3 October 2020 at 23:47:32 UTC, Max Haughton wrote: The guiding principle to your function parameters should be correctness - if I am passing a big struct around, if I want to take ownership of it I probably want to take it by value but if I want to modify it I should take it by

Re: dub fetching dependencies for wrong configuration(s)

2020-10-04 Thread ikod via Digitalmars-d-learn
On Sunday, 4 October 2020 at 14:08:24 UTC, Anonymouse wrote: My project depends on the requests dub package, which has two build configurations; one with an extra vibe-d dependency, one without (default). "configurations": [ { "name": "std" }, {

dub fetching dependencies for wrong configuration(s)

2020-10-04 Thread Anonymouse via Digitalmars-d-learn
My project depends on the requests dub package, which has two build configurations; one with an extra vibe-d dependency, one without (default). "configurations": [ { "name": "std" }, { "name": "vibed", "versions": ["vibeD"],

GC and sensible data read by File

2020-10-04 Thread frame via Digitalmars-d-learn
Hello, I'm new to D and try to find out a memory leak in my program. I inspected the private bytes with VmMap on Windows to see which data is still kept. Besides the actual memory leak I was surprised to find out there are contents of my previoulsy read configuration INI file. So my

Re: QuickSort on ranges

2020-10-04 Thread jerome via Digitalmars-d-learn
Thanks you very much Ali, I will try to wrap my head around your inputs, and get a better understanding of ranges in the process. I feel there is a lot of power in D ranges, and like the hammer of Thor, I am not worthy yet :)

Re: How to write a counterpart to C++ std::invoke that works with both free functions and methods?

2020-10-04 Thread 60rntogo via Digitalmars-d-learn
On Tuesday, 29 September 2020 at 01:19:48 UTC, Adam D. Ruppe wrote: On Sunday, 27 September 2020 at 05:22:36 UTC, 60rntogo wrote: How would I check if it is actually a free function? but this doesn't even compile since I defined add inside my main function ah that's not a free