Re: Bug or feature? iota has different semantics for integer and float arguments

2023-01-07 Thread Arredondo via Digitalmars-d-learn
On Saturday, 7 January 2023 at 02:31:14 UTC, Ali Çehreli wrote: On 1/6/23 17:50, Arredondo wrote: > Would anyone volunteer to file a bug report? Me! Me! :) https://issues.dlang.org/show_bug.cgi?id=23604 Ali Thanks a lot :D Arredondo.

Re: Bug or feature? iota has different semantics for integer and float arguments

2023-01-06 Thread Arredondo via Digitalmars-d-learn
On Saturday, 7 January 2023 at 00:52:20 UTC, Ali Çehreli wrote: Although that difference is a bug, iota does have a special floating point implementation to prevent the accumulation of floating point errors. Thank you for this clarification Ali. I appreciate the fact that there is a

Bug or feature? iota has different semantics for integer and float arguments

2023-01-06 Thread Arredondo via Digitalmars-d-learn
Consider: ``` import std.range.iota; auto r = iota(5, 0); ``` `r` is an empty range, as it should be. But if you call: ``` auto r = iota(5.0, 0); ``` then you get an exception (incorrect startup parameters). This was unexpected, and a pain to debug. What is the rationale behind iota having

Re: Integer programming in D?

2021-07-19 Thread Arredondo via Digitalmars-d-learn
On Monday, 19 July 2021 at 14:37:01 UTC, jmh530 wrote: glpk can handle mixed integer programming problems. Since it is a C library, it would be pretty easy to call from D but I don't see a binding or anything available. I would try to call it with dpp and if that doesn't work then something

Integer programming in D?

2021-07-19 Thread Arredondo via Digitalmars-d-learn
Is there an integer linear programming/discrete optimization library for D? an equivalent to the JuMP library for Julia for instance. Doesn't have to be too big, I really only need to solve a few smallish binary linear systems, but taking a quick look at code.dlang I did not immediately find

Re: How to sort a multidimensional ndslice?

2020-08-18 Thread Arredondo via Digitalmars-d-learn
On Tuesday, 18 August 2020 at 04:07:56 UTC, 9il wrote: To reorder the columns data according to precomputed index: auto index = a.byDim!1.map!sum.slice; Hello Ilya, thanks for the answer! Unfortunately I can't use it because I don't have (and can't define) a sorting index for my columns. I

How to sort a multidimensional ndslice?

2020-08-17 Thread Arredondo via Digitalmars-d-learn
I want to sort a two-dimensional ndslice by its columns according to some predefined predicate. What I mean is _not_ sorting the contents of each column individually, but instead to reorder the entire columns of the matrix so that they are sorted according to some "greater than" function.

in vs inout

2020-04-30 Thread Arredondo via Digitalmars-d-learn
The recent change log for v2.092.0 Beta says that with the new implementation for the `in` storage class: `in` should be the storage class of choice for purely input function parameters. I had been using inout for some time now for "purely input function parameters". Is there a case to be

Re: Get variable symbol name that was passed to a paramater?

2019-10-15 Thread Arredondo via Digitalmars-d-learn
So, 6 years later, what is the idiomatic way of doing this? Has there been any progress on this matter? As far as I can tell from this thread, all proposed solutions are imperfect in some way, which is a shame for a language with "Second to none reflection". Arredondo. On Saturday, 9

Re: Unexpected behaviour in associative array

2019-04-21 Thread Arredondo via Digitalmars-d-learn
On Sunday, 21 April 2019 at 00:13:15 UTC, 9il wrote: In the latest release you can do yourSlice.lightConst.field lightConst converts from const slice to slice of const. I will add const and immutable field to the next major release. That is very good to know. BWT, I think ndslice is an

Re: Unexpected behaviour in associative array

2019-04-20 Thread Arredondo via Digitalmars-d-learn
On Saturday, 20 April 2019 at 14:24:34 UTC, 9il wrote: On Friday, 19 April 2019 at 12:37:10 UTC, Arredondo wrote: Slice!(Contiguous, [2], byte*) payload; BTW, any reason not to use the new version of ndslice? For new API it would be: Slice!(byte*, 2, Contiguous) or just Slice!(byte*,

Re: Unexpected behaviour in associative array

2019-04-19 Thread Arredondo via Digitalmars-d-learn
On Friday, 19 April 2019 at 12:48:32 UTC, Adam D. Ruppe wrote: It might just be that toHash is secretly dependent on various attributes in the signature. You nailed it. This was it. It was not trivial to add the missing @safe and const attributes, but it worked. Thanks!

Re: Unexpected behaviour in associative array

2019-04-19 Thread Arredondo via Digitalmars-d-learn
On Friday, 19 April 2019 at 12:43:06 UTC, Adam D. Ruppe wrote: On Friday, 19 April 2019 at 12:03:33 UTC, Arredondo wrote: key in aa Keep in mind that D's `in` operator returns a *pointer* to the element, or null if it isn't there. If you aren't treating the return value as a pointer, you

Re: Unexpected behaviour in associative array

2019-04-19 Thread Arredondo via Digitalmars-d-learn
On Friday, 19 April 2019 at 11:32:17 UTC, Andre Pany wrote: Could you please post the coding, otherwise it is quite hard to help you. Here's a reasonably-sized code fragment that demonstrates the issue. I hope the comments along the way are descriptive enough Thanks, Arredondo --

Re: Unexpected behaviour in associative array

2019-04-19 Thread Arredondo via Digitalmars-d-learn
On Friday, 19 April 2019 at 11:55:41 UTC, Andre Pany wrote: https://dub.pm/commandline.html#dustmite Thanks, but it appears that this tool is used to isolate the cause of build errors, and I'm not having build errors, just unexpected behavior at runtime. Something I have observed while

Re: Unexpected behaviour in associative array

2019-04-19 Thread Arredondo via Digitalmars-d-learn
On Friday, 19 April 2019 at 11:32:17 UTC, Andre Pany wrote: Could you please post the coding, otherwise it is quite hard to help you. Kind regards Andre Yes, I'm working on isolating the problem. It's a bit laborious because the custom Struct is actually a wrapper around an ndslice

Unexpected behaviour in associative array

2019-04-19 Thread Arredondo via Digitalmars-d-learn
Hi all, I'm using a custom Struct as the key type in an associative array. I have defined the toHash() and opEquals(...) functions, and the problem I'm having is that the test mykey in aa always fails (returns null) even though there are keys in the aa that return identical toHash() values

Stateful modules and extern(C)

2018-05-24 Thread Arredondo via Digitalmars-d-learn
I want to call some of my D code from Python. I'm annotating the pertinent functions with extern(C) export, as in module foo; extern(C) export int initialize() { return 42; } I compile with: dmd -fPIC -shared ./foo.d From the Python end, I can load the library using ctypes and the call

Re: Unexpected behaviour of foreach statement

2018-03-02 Thread Arredondo via Digitalmars-d-learn
On Friday, 2 March 2018 at 10:32:08 UTC, Jonathan M Davis wrote: foreach does not support indices for ranges, only arrays. When you have foreach(e; range) it gets lowered to foreach(auto __range = range; !__range.empty; __range.popFront()) { auto e = __range.front; } There are no

Re: Unexpected behaviour of foreach statement

2018-03-02 Thread Arredondo via Digitalmars-d-learn
On Friday, 2 March 2018 at 10:34:31 UTC, bauss wrote: You can also call "array" from "std.array". auto range = iota(5).array; foreach (i, el; range) { writeln(i, ": ", el); } Thank you. That's how I had it in my original code, I was just trying to avoid gratuitous memory

Re: Unexpected behaviour of foreach statement

2018-03-02 Thread Arredondo via Digitalmars-d-learn
On Friday, 2 March 2018 at 10:27:27 UTC, Nicholas Wilson wrote: try https://dlang.org/phobos/std_range.html#enumerate This worked. Thank you!

Unexpected behaviour of foreach statement

2018-03-02 Thread Arredondo via Digitalmars-d-learn
Hi, The following works as expected: auto range = [1, 2, 3, 4, 5]; foreach (i, el; range) { writeln(i, ": ", el); } but this slight modification doesn't: auto range = iota(5); foreach (i, el; range) { writeln(i, ": ", el); } DMD 2.078.3 says: Error: cannot infer argument

Re: Help using lubeck on Windows

2018-02-26 Thread Arredondo via Digitalmars-d-learn
On Monday, 26 February 2018 at 17:40:05 UTC, jmh530 wrote: On Monday, 26 February 2018 at 17:12:51 UTC, Arredondo wrote: Okay, so I just finished configuring WSL. The way I want to use my app is having it read from stdin, do some calculations, and write to stdout, in an infinite cycle. I

Re: Help using lubeck on Windows

2018-02-26 Thread Arredondo via Digitalmars-d-learn
On Monday, 26 February 2018 at 05:15:48 UTC, jmh530 wrote: On Sunday, 25 February 2018 at 14:25:04 UTC, Arredondo wrote: On Friday, 23 February 2018 at 16:56:13 UTC, jmh530 wrote: I had given up and used WSL at this point rather than compile it myself with CMAKE. Less of a headache. I don’t

Re: Help using lubeck on Windows

2018-02-25 Thread Arredondo via Digitalmars-d-learn
On Friday, 23 February 2018 at 16:56:13 UTC, jmh530 wrote: I had given up and used WSL at this point rather than compile it myself with CMAKE. Less of a headache. I don’t understand. Wouldn’t WSL produce Linux binaries? I need my project compiled as a Windows .exe, other parts of my

Re: Help using lubeck on Windows

2018-02-25 Thread Arredondo via Digitalmars-d-learn
On Friday, 23 February 2018 at 18:29:09 UTC, Ilya Yaroshenko wrote: openblas.net contains precompiled openblas library for Windows. It may not be optimised well for exactly your CPU but it is fast enought to start. Put the library files into your prodject and add openblas library to your

Help using lubeck on Windows

2018-02-23 Thread Arredondo via Digitalmars-d-learn
Help using lubeck on Windows I'd like to experiment with linear algebra in D, and it looks like lubeck is the way to do it right now. However, I'm having a hard time dealing with the CBLAS and LAPACK dependencies. I downloaded the OpenBLAS binaries for Windows (libopenblas.dll), but I am

Re: How to proceed with learning to code Windows desktop applications?

2018-01-31 Thread Arredondo via Digitalmars-d-learn
On Tuesday, 30 January 2018 at 18:52:18 UTC, I Lindström wrote: On Tuesday, 30 January 2018 at 12:30:36 UTC, rjframe wrote: VS release builds compile to native now by default; for easy Windows programming, you really can't beat C# and drawing the GUI (Windows Forms, not necessarily the new