Re: Hookable Swap

2019-05-19 Thread Era Scarecrow via Digitalmars-d-learn
On Monday, 20 May 2019 at 02:18:51 UTC, Era Scarecrow wrote: Here's some outputs if you are interested Noticing how Heapify moves a large portion of areas more or less in their location, doing heapify before binary insertion sort lowers how much moving goes on quite a bit. Doing 2 heapify's

Re: Hookable Swap

2019-05-19 Thread Era Scarecrow via Digitalmars-d-learn
On Sunday, 19 May 2019 at 06:13:13 UTC, Era Scarecrow wrote: Making a struct type/array that visually outputs and displays compares/mutations of a type. While using the library sorting functions (which relies on std.algorithm.mutation.swap Well been having fun with sorting and more of this;

Re: Tweakig -lowmem to be more eager

2019-05-19 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 19 May 2019 at 23:54:27 UTC, Anonymouse wrote: Tweakig I'd edit the title if I could. Grumble mutter.

Tweakig -lowmem to be more eager

2019-05-19 Thread Anonymouse via Digitalmars-d-learn
I have CircleCI set up to test my project when I push to GitHub. For a free user there the memory restriction is pretty severe (4 Gb), and as such non-trivial programs cannot be compiled without separate compilation. This sounded like a clear-cut case for -lowmem, but the process is still

Re: Linked List iterating over and inserting an element around (before/after) the current position.

2019-05-19 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 19 May 2019 at 22:20:48 UTC, Josh wrote: Thank you, that helps big time. This is just more curiosity, but do you happen to know why I have to use DList.linearRemove() instead of DList.remove()? import std.stdio; import std.container.dlist; import std.algorithm; import std.range;

Re: Linked List iterating over and inserting an element around (before/after) the current position.

2019-05-19 Thread Boris-Barboris via Digitalmars-d-learn
On Sunday, 19 May 2019 at 22:20:48 UTC, Josh wrote: This is just more curiosity, but do you happen to know why I have to use DList.linearRemove() instead of DList.remove()? These two functions are separate because they differ in complexity. remove is O(1), linearRemove on the other hand

Re: Linked List iterating over and inserting an element around (before/after) the current position.

2019-05-19 Thread Josh via Digitalmars-d-learn
Thank you, that helps big time. This is just more curiosity, but do you happen to know why I have to use DList.linearRemove() instead of DList.remove()? import std.stdio; import std.container.dlist; import std.algorithm; import std.range; void main() { auto list = make!DList("the",

Re: Linked List iterating over and inserting an element around (before/after) the current position.

2019-05-19 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 19 May 2019 at 20:55:28 UTC, Josh wrote: Just started looking at D this weekend, coming from a C++/Java/Go/Rust background and it's really not going well. Trying to write something to play with the language and need a linked list, looking in std.container you have a single or

Re: How to get type returned by e.g. std.algorithm.iteration.filter

2019-05-19 Thread Christian Köstlin via Digitalmars-d-learn
Last version using more from the outer template #!/usr/bin/env rdmd import std.stdio; import std.algorithm; import std.typecons; import std.array; import std.range; import std.traits; auto byMinimum(Ranges)(Ranges ranges) { auto getNonEmpty() { return ranges.filter!("!a.empty");

Linked List iterating over and inserting an element around (before/after) the current position.

2019-05-19 Thread Josh via Digitalmars-d-learn
Just started looking at D this weekend, coming from a C++/Java/Go/Rust background and it's really not going well. Trying to write something to play with the language and need a linked list, looking in std.container you have a single or doubly linked list...great. Now how to I iterate over

Re: How to get type returned by e.g. std.algorithm.iteration.filter

2019-05-19 Thread Christian Köstlin via Digitalmars-d-learn
On 19.05.19 20:38, Jacob Carlborg wrote: On 2019-05-19 15:36, Christian Köstlin wrote: Unfortunately I have no idea how to even store the result of this search in an attribute of ByMinimum, as I cannot writeout its type. In general you can use `typeof()`, where `` is the expression you want

Re: Basic Linear Algebra and D's Array Operation

2019-05-19 Thread Andrew Edwards via Digitalmars-d-learn
On Sunday, 19 May 2019 at 17:13:11 UTC, Alex wrote: The operation itself is, however, a simple one. To implement a basic version I would cite http://rosettacode.org/wiki/Matrix_multiplication#D This is awesome. Thank you very much. Andrew

Re: Same code different behaviour in debug & release mode?

2019-05-19 Thread Era Scarecrow via Digitalmars-d-learn
On Sunday, 19 May 2019 at 17:55:10 UTC, Robert M. Münch wrote: It seems that the debugger has quite some problem when the code was compiled with optimization and debug-information. I remember having similar problems in a C program years ago, ended up just releasing the code unoptimized and

Re: How to get type returned by e.g. std.algorithm.iteration.filter

2019-05-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2019-05-19 15:36, Christian Köstlin wrote: Unfortunately I have no idea how to even store the result of this search in an attribute of ByMinimum, as I cannot writeout its type. In general you can use `typeof()`, where `` is the expression you want to get the type of. -- /Jacob Carlborg

Re: Some debug(...) guarded code in a module included, some not...

2019-05-19 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-05-19 13:13:16 +, Robert M. Münch said: I use debug(...) specifications on my code. My app works when compiled in debug mode. When I compile in release mode and explicitly use: debug = debugprints; on module level, my understanding is, that the debug guarded code will be

Re: Same code different behaviour in debug & release mode?

2019-05-19 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-05-19 16:11:19 +, Robert M. Münch said: I'm wondering why the root and win.layout_root values are not the same? What's happening here? I thought that root is a class reference which uses the same data as win.layout_root. When I compile in debug mode and run the same code, the

Re: Basic Linear Algebra and D's Array Operation

2019-05-19 Thread James Blachly via Digitalmars-d-learn
On 5/19/19 2:34 AM, Andrew Edwards wrote: P.S. Why do we still have two sets of documentations ([1],[2]) for the language? Which is the official one and when can we get rid of the other? [1] https://dlang.org/library/std/array.html [2] https://dlang.org/phobos/std_array.html I have wondered

Re: Basic Linear Algebra and D's Array Operation

2019-05-19 Thread Alex via Digitalmars-d-learn
On Sunday, 19 May 2019 at 16:17:17 UTC, Andrew Edwards wrote: ´´´ import std; void main() { int[][] M = [[1,2,3],[1,2,3],[1,2,3]]; M.recursiveMultiplier(4); writeln(M); } void recursiveMultiplier(T, V)(T arr, V val) @nogc { static if(isArray!(ElementType!T))

Re: Meson build system user learning D.

2019-05-19 Thread Mike Brockus via Digitalmars-d-learn
On Sunday, 19 May 2019 at 07:46:11 UTC, Johannes Loher wrote: Am 18.05.19 um 08:20 schrieb Mike Brockus: Hello there this is your hometown Meson build system user here just happen to have a question related to unit testing in D. So is there a way to run the unit-test in the test main as a

Re: Basic Linear Algebra and D's Array Operation

2019-05-19 Thread Andrew Edwards via Digitalmars-d-learn
On Sunday, 19 May 2019 at 10:07:35 UTC, Alex wrote: On Sunday, 19 May 2019 at 06:34:18 UTC, Andrew Edwards wrote: So the question is, how do I pull this off in D using just builtin arrays and phobos? Any assistance is appreciated. Slice operations exist, but they are defined mainly for

Same code different behaviour in debug & release mode?

2019-05-19 Thread Robert M. Münch via Digitalmars-d-learn
I have the following code I compile in release mode but with "debugInfo" bulildOptions in my dub.json: gob root = win.layout_root = new gob(); After executing this code line I see this in the debugger: Name Wert Typ ◢ root 0x00f17deff760 {node=0x7ff629fb {__guard_fids_table} {},

Re: GTKD - overrideBackgroundColor of Button doesn't work

2019-05-19 Thread Ron Tarrant via Digitalmars-d-learn
On Wednesday, 22 June 2016 at 07:57:01 UTC, TheDGuy wrote: I am wondering if it is possible to get the name of the current CSS-class the button is asigned to? Very late to this party, but: getName() does the job.

How to get type returned by e.g. std.algorithm.iteration.filter

2019-05-19 Thread Christian Köstlin via Digitalmars-d-learn
I would like to join several sorted files into one big sorted file. For that I came up with this snippet: #!/usr/bin/env rdmd import std.stdio; import std.algorithm; import std.typecons; import std.array; import std.range; auto byMinimum(Ranges)(Ranges ranges) { auto getNonEmpty() {

What compiles faster?

2019-05-19 Thread Andrey via Digitalmars-d-learn
Hello, Let we have got 3 template functions: void func1(int a)() {} void func2(int a, string b)() {} void func3(int a, string b, bool c)() {} As we see, the first function accepts 1 template argument, the second - 2 and the third - 3. What compiles faster: 1. When a program has got 100

Some debug(...) guarded code in a module included, some not...

2019-05-19 Thread Robert M. Münch via Digitalmars-d-learn
I use debug(...) specifications on my code. My app works when compiled in debug mode. When I compile in release mode and explicitly use: debug = debugprints; on module level, my understanding is, that the debug guarded code will be included. But, some debug guarded code is include and some

Re: Framework design, initialization and framework usage

2019-05-19 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-05-12 17:33:16 +, kdevel said: On Wednesday, 8 May 2019 at 09:15:41 UTC, Ron Tarrant wrote: On Wednesday, 8 May 2019 at 06:30:56 UTC, Robert M. Münch wrote: Our focus is executable size (I'm an old school guy) and speed. What about correctness? Correctness of what? Of the

Re: Does -profile need the D runtime?

2019-05-19 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-05-18 17:46:52 +, Stefan Koch said: On Saturday, 18 May 2019 at 16:35:44 UTC, Robert M. Münch wrote: I want to profile my windows app which has a WinMain(). One of the first statements in WinMain() within a try{} is: Runtime.initialize(); But when I compile my app with -profile,

[OT] Re: 1 - 17 ms, 553 ╬╝s, and 1 hnsec

2019-05-19 Thread Patrick Schluter via Digitalmars-d-learn
On Saturday, 18 May 2019 at 21:05:13 UTC, Les De Ridder wrote: On Saturday, 18 May 2019 at 20:34:33 UTC, Patrick Schluter wrote: * hurrah for French keyboard which has a rarely used µ key, but none for Ç a frequent character of the language. That's the lowercase ç. The uppercase Ç is not

Re: Basic Linear Algebra and D's Array Operation

2019-05-19 Thread Alex via Digitalmars-d-learn
On Sunday, 19 May 2019 at 06:34:18 UTC, Andrew Edwards wrote: Sooo... I'm trying to learn this stuff so that I can fully grasp the content of Jens Mueller's 2019 DConf talk and its applications in financial sector (forex and options/futures trading). Unfortunately, I'm doing so using python

Re: Meson build system user learning D.

2019-05-19 Thread Johannes Loher via Digitalmars-d-learn
Am 18.05.19 um 08:20 schrieb Mike Brockus: > Hello there this is your hometown Meson build system user here just > happen to have a > question related to unit testing in D. > > So is there a way to run the unit-test in the test main as a costume > test runner in > "test/test.d", and run the

Re: is there a way to embed python 3.7 code in D program?

2019-05-19 Thread torea via Digitalmars-d-learn
On Monday, 13 May 2019 at 03:06:07 UTC, evilrat wrote: On Monday, 13 May 2019 at 01:35:58 UTC, evilrat wrote: I have project using pyd with python 3.7, that also using ptvsd (visual studio debugger for python package) to allow mixed debugging right inside VS Code. I'll reduce the code and

Basic Linear Algebra and D's Array Operation

2019-05-19 Thread Andrew Edwards via Digitalmars-d-learn
Sooo... I'm trying to learn this stuff so that I can fully grasp the content of Jens Mueller's 2019 DConf talk and its applications in financial sector (forex and options/futures trading). Unfortunately, I'm doing so using python but I'd like to accomplish the same in D. Here goes: Array

Hookable Swap

2019-05-19 Thread Era Scarecrow via Digitalmars-d-learn
Making a struct type/array that visually outputs and displays compares/mutations of a type. While using the library sorting functions (which relies on std.algorithm.mutation.swap) it doesn't call opAssign and doesn't pass through the struct. (which also changes the indexes which it shouldn't).