Re: Schroedinger's Ranges

2021-06-02 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 3 June 2021 at 00:39:04 UTC, vacuum_tube wrote: I've been trying to make a struct for CSV parsing and manipulating. The code was as follows: ``` struct CSVData(bool HeaderFromFirstLine) { char[][] header = []; char[][][] rest = []; this(string filename)

Schroedinger's Ranges

2021-06-02 Thread vacuum_tube via Digitalmars-d-learn
I've been trying to make a struct for CSV parsing and manipulating. The code was as follows: ``` struct CSVData(bool HeaderFromFirstLine) { char[][] header = []; char[][][] rest = []; this(string filename) { auto tmp = File(filename).byLine();

Re: Missing stacktrace on memory allocation failure

2021-06-02 Thread Mathias LANG via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 17:52:12 UTC, mw wrote: On Thursday, 12 November 2020 at 13:16:21 UTC, Steven Schveighoffer wrote: On 11/12/20 4:22 AM, Per Nordlöw wrote: Why don't I get a stack trace on Memory allocation exceptions? In my case I only get: src/core/exception.d(647): [unittest]

Re: How to compile Phobos with other D code to create a shared library?

2021-06-02 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 1 June 2021 at 18:18:35 UTC, data pulverizer wrote: Doing `Runtime.initialize` is working with Julia but not yet R, I'm getting a clock/GLIBC error ``` Error in dyn.load("rbasic.so") : unable to load shared object 'code/rbasic.so': lib/x86_64-linux-gnu/librt.so.1: undefined

Re: How to compile Phobos with other D code to create a shared library?

2021-06-02 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 17:49:49 UTC, Steven Schveighoffer wrote: What's happening is that the dynamic linker is trying to resolve that symbol, but cannot find it in the given library. Try `ldd code/rbasic.so` and see if it tells you the things it is looking for. Many times, you will

Re: cloning array

2021-06-02 Thread Sean via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 15:32:38 UTC, Sean wrote: if so, how can I get the behavior i am searching for? Thank you. My current solution, if anyone wonders : https://github.com/patefacio/d-help/blob/master/d-help/opmix/dup.d

Re: Missing stacktrace on memory allocation failure

2021-06-02 Thread mw via Digitalmars-d-learn
On Thursday, 12 November 2020 at 13:16:21 UTC, Steven Schveighoffer wrote: On 11/12/20 4:22 AM, Per Nordlöw wrote: Why don't I get a stack trace on Memory allocation exceptions? In my case I only get: src/core/exception.d(647): [unittest] Memory allocation failed

Re: cloning array

2021-06-02 Thread Basile.B via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 16:50:16 UTC, Gavin Ray wrote: On Wednesday, 2 June 2021 at 16:07:35 UTC, Basile.B wrote: works a expected. The reason why is that your array elements are fat pointers, so when you dup a, you dup some fats pointer, so you got the same elements as "a" but accessible

Re: How to compile Phobos with other D code to create a shared library?

2021-06-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/1/21 2:18 PM, data pulverizer wrote: Doing `Runtime.initialize` is working with Julia but not yet R, I'm getting a clock/GLIBC error ``` Error in dyn.load("rbasic.so") :   unable to load shared object 'code/rbasic.so':   lib/x86_64-linux-gnu/librt.so.1: undefined symbol:

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-06-02 Thread evilrat via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 05:43:49 UTC, evilrat wrote: Yep, use Skia/Cairo or something like this, don't build your own full blown 2D engine for every possible graphics API. I would like to tune my C++ bindings generator to be able to handle Skia ASAP, but can't tell when it will be

Re: cloning array

2021-06-02 Thread Gavin Ray via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 16:07:35 UTC, Basile.B wrote: works a expected. The reason why is that your array elements are fat pointers, so when you dup a, you dup some fats pointer, so you got the same elements as "a" but accessible from another chunck of memory. Would it be worth

Re: cloning array

2021-06-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/2/21 11:32 AM, Sean wrote: Is this normal behavior of dup? if so, how can I get the behavior i am searching for? Thank you. Yes. `dup` is a shallow copy. To get the behavior you want: ```d auto deepdup(T)(T[] arr) { import std.algorithm, std.array; static if(is(T == U[], U))

Re: foreach: How start a foreach count with specific number?

2021-06-02 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 15:49:36 UTC, Marcone wrote: But I don't want it starts with 0, but other number. How can I do it? Easiest way is to just add the starting number: size_t start = 5; foreach (n, i; glob("*")) { print("{} DATA {}".format(n, start + i)); } You

Re: cloning array

2021-06-02 Thread Sean via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 16:18:03 UTC, Basile.B wrote: Maybe Mir would help. Tried. However, I am more of a mathematician, than a software developer. So writing my own code was easier than to follow through the design philosophy and internalize the idioms and styles of Mir. When this

Re: cloning array

2021-06-02 Thread Basile.B via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 16:08:14 UTC, Sean wrote: On Wednesday, 2 June 2021 at 15:59:38 UTC, Basile.B wrote: works as you expect Okey, so I have to copy every (N-1) dimensional element - one after one - if the array is N dimensional, with N > 1, and repeat it for every element if they

Re: cloning array

2021-06-02 Thread Basile.B via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 15:59:38 UTC, Basile.B wrote: On Wednesday, 2 June 2021 at 15:32:38 UTC, Sean wrote: works as you expect On Wednesday, 2 June 2021 at 15:59:38 UTC, Basile.B wrote: ```d import std; void main() { auto a = new double[][] (0,0); a ~= [ 1.0, 2.45]; a ~=

Re: cloning array

2021-06-02 Thread Sean via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 15:59:38 UTC, Basile.B wrote: works as you expect Okey, so I have to copy every (N-1) dimensional element - one after one - if the array is N dimensional, with N > 1, and repeat it for every element if they themselves are arrays with dimension M > 1 ? This

Re: foreach: How start a foreach count with specific number?

2021-06-02 Thread Ali Çehreli via Digitalmars-d-learn
On 6/2/21 8:49 AM, Marcone wrote: > But I don't want it starts with 0, but other number. How can I do it? It is not configurable but is trivial by adding a base value: import std.stdio; enum base = 17; void main() { auto arr = [ "hello", "world" ]; foreach (i, str; arr) { const count

Re: cloning array

2021-06-02 Thread Basile.B via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 15:32:38 UTC, Sean wrote: Hello I have seen this : https://forum.dlang.org/thread/1473526717.1917.20.ca...@winder.org.uk Now, please consider this code: import std.stdio; import std.math; import std.stdio; import std.conv; import std.format; import std.math;

foreach: How start a foreach count with specific number?

2021-06-02 Thread Marcone via Digitalmars-d-learn
Example: // --args "C:\Users\Usuario\Downloads\dist\Programa.exe" import modulo; void main(string[] args){ if (args.length >= 2) { string exePrincipal = args[1]; chdir(exePrincipal.dirName); foreach(n, i;

cloning array

2021-06-02 Thread Sean via Digitalmars-d-learn
Hello I have seen this : https://forum.dlang.org/thread/1473526717.1917.20.ca...@winder.org.uk Now, please consider this code: import std.stdio; import std.math; import std.stdio; import std.conv; import std.format; import std.math; import std.algorithm; import std.net.curl; import

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-06-02 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 10:17:52 UTC, drug wrote: Usually 1 million of items aren't visible at once. Also there is opinion that total redrawing can be more efficient than caching because of making a decision what to cache and what not can be very complex. Depends on the application. My

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-06-02 Thread drug via Digitalmars-d-learn
02.06.2021 12:50, Ola Fosheim Grøstad пишет: Depends on the data, I guess, if they are all visible at once then you basically have to very carefully write your own GPU render stage for that view and carefully cache things that does not move by rendering them to buffers (in GPU memory).

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-06-02 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 09:37:10 UTC, drug wrote: 02.06.2021 00:47, Ola Fosheim Grøstad пишет: I tried retained and immediate GUI, both fail (imho) for my use case - large data set of 1M+ heterogeneous items. Depends on the data, I guess, if they are all visible at once then you

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-06-02 Thread drug via Digitalmars-d-learn
02.06.2021 00:47, Ola Fosheim Grøstad пишет: Note: Many simple GUI toolkits are horribly inefficient as they let each object render themselves.  An efficient GUI engine will have to replicate some of the browser complexity... I tried retained and immediate GUI, both fail (imho) for my use

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-06-02 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 01:29:51 UTC, cc wrote: It's 2021 and I'm still waiting for parent selectors. Even :has() isn't implemented by anything yet. I think that is because :has() is Selectors Level 4, which is a working draft, so not a standard yet.