I made some changes to some code I'm working on and now there are
some lines that are giving me funky DMD error codes (I can tell
it is some lines because I comment them out and the errors go
away). So for instance, one line I have a static assert that
gives an error code -1073741819, but if I
On Tuesday, 3 May 2022 at 19:03:56 UTC, Dennis wrote:
On Tuesday, 3 May 2022 at 18:22:49 UTC, jmh530 wrote:
Does anyone have any idea what causes these types of errors?
Sounds like a stack overflow, maybe your code has a
complex/recursive part that makes DMD's call stack very deep.
Thanks.
In the code below, there is a two parameter function `foo` and an
override of it with only one parameter. In the override case, I
force the second one to be 1, but ideally there should be a way
to specify it at compile-time.
It would be kind of nice to be able to do it with an enum and a
dele
On Saturday, 7 May 2022 at 18:46:03 UTC, Paul Backus wrote:
On Saturday, 7 May 2022 at 18:36:40 UTC, jmh530 wrote:
In the code below, there is a two parameter function `foo` and
an override of it with only one parameter. In the override
case, I force the second one to be 1, but ideally there sh
On Saturday, 7 May 2022 at 23:30:37 UTC, Paul Backus wrote:
[snip]
Worth noting that you *can* write
```d
alias foo = partial!(foo, a);
```
...which will add the partially-applied version to `foo`'s
overload set.
You sure about that? Below fails to compile on godbolt with ldc
1.27.1 [1]. F
On Sunday, 8 May 2022 at 03:58:06 UTC, Tejas wrote:
[snip]
If there is only one possible value for the overload, is there
an issue with using default arguments?
[snip]
Default arguments are intended to be resolved at runtime. That
is, if you compile a function with two parameters and one o
On Monday, 9 May 2022 at 09:17:06 UTC, Alexander Zhirov wrote:
[snip]
It would be nice if dub included a directory of example
configurations for common issues like this.
On Tuesday, 10 May 2022 at 19:13:21 UTC, Dennis wrote:
[snip]
It has an example directory:
https://github.com/dlang/dub/tree/master/examples
If your configuration is missing, you could make a Pull Request
to add it.
So it does. Thanks.
We might also link to that on the dub.pm website.
On Tuesday, 10 May 2022 at 20:50:12 UTC, Alexander Zhirov wrote:
On Tuesday, 10 May 2022 at 19:13:21 UTC, Dennis wrote:
It has an example directory:
https://github.com/dlang/dub/tree/master/examples
And if there are two compilers in the system - `dmd` and `ldc`,
which compiler chooses `dub.js
On Wednesday, 11 May 2022 at 09:06:52 UTC, bauss wrote:
On Wednesday, 11 May 2022 at 05:41:35 UTC, Ali Çehreli wrote:
What are you stuck at? What was the most difficult features to
understand? etc.
To make it more meaningful, what is your experience with other
languages?
Ali
dip1000
Ha,
On Thursday, 12 May 2022 at 12:13:32 UTC, Basile B. wrote:
[snip]
```
is ( Type : TypeSpecialization , TemplateParameterList )
is ( Type == TypeSpecialization , TemplateParameterList )
is ( Type Identifier : TypeSpecialization ,
TemplateParameterList )
is ( Type Identifier == TypeSpecialization
On Thursday, 12 May 2022 at 15:32:24 UTC, Adam D Ruppe wrote:
On Thursday, 12 May 2022 at 15:18:34 UTC, jmh530 wrote:
What's the difference between a Type and Type Identifier?
The is expression roughly follows variable declaration style.
You write
int a;
to declare a new symbol named `a` of
In the code below, `x` and `y` are implicitly converted to `uint`
and `ushort` before the function preconditions are run.
Is there any way to change this behavior? It feels unintuitive
and I can't find in the spec where it says when the conversions
in this case occur, but it clearly happens be
On Tuesday, 24 May 2022 at 21:05:00 UTC, Steven Schveighoffer
wrote:
[snip]
```d
// e.g.
foo(int x)
in (x >= 0)
{
return foo(uint(x));
}
```
And remove those useless `in` conditions on the unsigned
versions, an unsigned variable is always >= 0.
-Steve
Thanks. That makes perfect sense. I
I was thinking about trying out importC with a library I have
used in the past (it's been a few years since I used it with D).
The library uses cmake to generate static or dynamic libraries (I
believe I did static with Windows and dynamic with Linux, but I
can't really recall).
My understandi
On Wednesday, 7 September 2022 at 00:31:53 UTC, zjh wrote:
On Tuesday, 6 September 2022 at 19:44:23 UTC, jmh530 wrote:
.
`xmake` is simpler.
Ok...but I didn't write the library so I can't exactly tell them
to use xmake when they already use cmake.
On Monday, 12 September 2022 at 16:39:14 UTC, Paul Backus wrote:
[snip]
Yes. Except for `@trusted`, explicit attributes on template
code are a smell.
[snip]
If I can be 100% sure that something will always be
@safe/nothrow/pure/@nogc, then I might consider marking them as
such. For instan
There is a C library I sometimes use that has a function that
takes two function pointers. However, there are some calculations
that are shared between the two functions that would get pointed
to. I am hoping to only need to do these calculations once.
The code below sketches out the general i
On Wednesday, 14 September 2022 at 18:02:07 UTC, JG wrote:
[snip]
Maybe others know better but I would have thought the only way
is to use globals to do this. Often c libraries that I have
used get round this by taking a function and a pointer and then
the library calls your function on the p
On Wednesday, 14 September 2022 at 19:34:56 UTC, Alain De Vos
wrote:
Let's say i want to plot the function f(x)=sin(x)/x.
Which API would you advice, in order for me to not re-invent
the wheel.
Have you tried ggplotd?
https://code.dlang.org/packages/ggplotd
On Wednesday, 21 September 2022 at 05:31:48 UTC, mw wrote:
Hi,
I'm just wondering what is the best way to read CSV data file
into Mir (2d array) ndslice? Esp. if it can parse date into
int/float.
I searched a bit, but can't find any example.
Thanks.
It probably can't hurt to try the simp
On Wednesday, 21 September 2022 at 13:08:14 UTC, jmh530 wrote:
On Wednesday, 21 September 2022 at 05:31:48 UTC, mw wrote:
Hi,
I'm just wondering what is the best way to read CSV data file
into Mir (2d array) ndslice? Esp. if it can parse date into
int/float.
I searched a bit, but can't find
On Sunday, 2 October 2022 at 21:18:43 UTC, mw wrote:
[snipping]
A CSV library should consider all the use cases, and allow
users to ignore certain fields.
In R, you have to force `NULL` for `colClasses` for the other
columns. In other words, the user has to know the number of
columns of the
On Monday, 17 October 2022 at 19:54:12 UTC, Yura wrote:
Dear All, Thank you so much for your replies and hints! I got
it working today. All the libraries are properly linked and the
Equation solver runs smoothly.
The compilers turned out to be problematic though. The "Mir"
library does not wo
On Thursday, 20 October 2022 at 11:59:45 UTC, data pulverizer
wrote:
[snip]
Mine is also private for now till it reaches an acceptable
state when I'll think about whether it should be publicly
released or jealously guarded. It's a project I'm building for
my own use really.
It can't hurt to
On Friday, 4 November 2022 at 16:56:59 UTC, Hipreme wrote:
[snip]
You can use any name instead. The only difference between an
ordinary source file and a package.d is the module name. For
instance, if you're inside the filesystem directory, you can
change the name to literally anything and im
On Friday, 4 November 2022 at 19:17:04 UTC, Adam D Ruppe wrote:
On Friday, 4 November 2022 at 19:10:33 UTC, jmh530 wrote:
If you don't plan to use private(package_name), then I don't
know what the point of it is.
This works fine without the package.d anyway.
Oh really, then what's the point
On Sunday, 4 December 2022 at 23:25:34 UTC, Adam D Ruppe wrote:
On Sunday, 4 December 2022 at 22:46:52 UTC, Ali Çehreli wrote:
That's way beyond my pay grade. Explain please. :)
The reason that the GC stops threads right now is to ensure
that something doesn't change in the middle of its anal
On Sunday, 1 January 2023 at 22:00:29 UTC, max haughton wrote:
On Sunday, 1 January 2023 at 21:11:06 UTC, Ogi wrote:
I’ve read this [series if
articles](https://www.gamedeveloper.com/design/decision-modeling-and-optimization-in-game-design-part-1-introduction) about using Excel Solver for all ki
On Wednesday, 1 February 2023 at 13:14:47 UTC, Siarhei Siamashka
wrote:
On Tuesday, 31 January 2023 at 01:04:41 UTC, Paul wrote:
Greetings,
for an array byte[3][3] myArr, I can code myArr[0] = 5 and
have:
5,5,5
0,0,0
0,0,0
Can I perform a similar assignment to the column? This,
myArr[][0]
The code below has two `foo` functions that take slices, one
accepts a const(T)* iterator and one accepts a generic Iterator
with the property that the slice isn't convertible to the first
one. The nice thing about this is that if you pass it with a
double* or const(double)*, then it doesn't in
I'm looking at the dub package format [1] about optional
dependencies and it says:
"With this set to true, the dependency will only be used if
explicitly selected in dub.selections.json. If omitted, this
attribute defaults to false."
And it occurs to me that I don't know anything about how
On Friday, 24 February 2023 at 19:37:41 UTC, Steven Schveighoffer
wrote:
On 2/24/23 2:01 PM, jmh530 wrote:
I'm looking at the dub package format [1] about optional
dependencies and it says:
"With this set to true, the dependency will only be used if
explicitly selected in dub.selections.json.
I was looking at [1] for ways to prevent the compiler from
optimizing away code when trying to benchmark.
It has the following C++ code as a simpler version:
```
inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp& value) {
asm volatile("" : "+r,m"(value) : : "memory");
}
```
I made an att
On Monday, 13 March 2023 at 15:23:25 UTC, user1234 wrote:
[snip]
[1]
https://theunixzoo.co.uk/blog/2021-10-14-preventing-optimisations.html
that's illegal code. You mix GCC/LLVM syntax with D asm block
and the front-end wont recognize that.
LDC recognizes a syntax similar to what is descr
On Thursday, 23 March 2023 at 11:46:48 UTC, matheus wrote:
On Thursday, 23 March 2023 at 09:39:40 UTC, John Xu wrote:
Anybody know any working REPL program? I failed to find a
working one.
https://github.com/dlang-community/drepl
can't compile on my Windows 10, dub reports:
...
According to
On Friday, 19 May 2023 at 18:31:45 UTC, Maximilian Naderer wrote:
Hello guys,
So what’s currently the best way to use a big C library?
Let’s assume something like
cglm
assimp
glfw
ImportC doesn’t really work for such huge libraries, I’ll
investigate further. Deimos is outdated or there are n
On Thursday, 29 June 2023 at 14:18:05 UTC, kiriakov wrote:
How to create option type over std.sumtype ?
```
enum None;
struct Some(T) { T x; }
alias Option = SumType!(Some!T, None);
```
I get
Error: undefined identifier `T`
Try
```d
alias Option(T) = SumType!(Some!T, None);
```
Your version
On Friday, 18 August 2023 at 08:06:10 UTC, Ki Rill wrote:
On Friday, 18 August 2023 at 07:57:05 UTC, Ki Rill wrote:
On Friday, 18 August 2023 at 07:54:04 UTC, Ki Rill wrote:
Is there an up-to-date tutorial?
It's just painful that I cannot find anything helpful on this
topic. The official mir-
On Friday, 18 August 2023 at 12:14:45 UTC, Ferhat Kurtulmuş wrote:
On Friday, 18 August 2023 at 09:57:11 UTC, Ki Rill wrote:
[...]
Yes there isn't many guides around. Those are some of them.
https://tastyminerals.github.io/tasty-blog/dlang/2020/03/22/multidimensional_arrays_in_d.html
https:/
On Saturday, 26 August 2023 at 16:57:42 UTC, solidstate1991 wrote:
After a recent update, Visual Studio 2022 started to have
serious troubles with D, namely having troubles with displaying
debug variables, and growing constantly in memory until you
either stop debugging or crashes Windows.
Cu
On Sunday, 29 October 2023 at 10:44:03 UTC, ryuukk_ wrote:
[snip]
This is sad that people recommend OOP for this
Julia doesn't have OOP and it took over, and that's what i'd
recommend your students to check, C++ is a dead end, Julia it
is for mathematical computing
If D had tagged union and
On Monday, 30 October 2023 at 13:24:56 UTC, Sergey wrote:
On Monday, 30 October 2023 at 13:13:47 UTC, jmh530 wrote:
On Sunday, 29 October 2023 at 10:44:03 UTC, ryuukk_ wrote:
Julia is more an alternative to R, Matlab, Python than C++.
Not really.
Many especially popular and widely used (NumPy
On Monday, 8 January 2024 at 21:56:10 UTC, Renato wrote:
[snip]
Importing .h files from d files isn't supported yet because of
a dispute with the lookup priority:
https://issues.dlang.org/show_bug.cgi?id=23479
https://issues.dlang.org/show_bug.cgi?id=23547
Ah, too bad. Anyway, I was just pl
When I navigate to https://forum.dlang.org/ I have a message that
says "1 new reply" to "your posts." Normally, I click on that "1
new reply" and find the post that's new, go to it, and the
message disappears. However, it doesn't seem to go away anymore.
I tried looking at many different old po
On Tuesday, 17 September 2019 at 01:54:01 UTC, Brett wrote:
How does one get return values?
https://matplotlib.org/3.1.0/gallery/statistics/hist.html
Shows that python uses return values to set properties of the
plot
https://github.com/koji-kojiro/matplotlib-d/blob/master/examples/source/app
On Thursday, 10 October 2019 at 15:47:58 UTC, Just Dave wrote:
In C# you can do something like:
if (obj is Person)
{
var person = obj as Person;
// do stuff with person...
}
where you can check the type of an object prior to casting.
Does D have a similar mechanism
On Thursday, 10 October 2019 at 16:33:47 UTC, H. S. Teoh wrote:
On Thu, Oct 10, 2019 at 03:58:02PM +, jmh530 via
Digitalmars-d-learn wrote:
On Thursday, 10 October 2019 at 15:47:58 UTC, Just Dave wrote:
> In C# you can do something like:
>
>
> if (obj is Person)
>
On Friday, 11 October 2019 at 17:50:42 UTC, Jonathan M Davis
wrote:
[snip]
A very thorough explanation!
One follow-up question: would it be possible to mimic the
behavior of Java generics in D?
On Saturday, 12 October 2019 at 21:44:57 UTC, Jonathan M Davis
wrote:
[snip]
Thanks for the reply.
As with most people, I don't write a lot of D code that uses
classes that much.
The use case I'm thinking of is with allocators, which - to be
honest - is not something I deal with much in m
On Monday, 14 October 2019 at 19:27:04 UTC, Andre Pany wrote:
[snip]
I found this tool https://github.com/gtkd-developers/gir-to-d
from Mike Wey which translates GObject GIR files to D headers.
It might be interesting for some of this functionality to get
included in dpp.
On Friday, 18 October 2019 at 07:35:21 UTC, Martin Tschierschke
wrote:
[snip]
I think this is something that's been proposed before, but most
people are happy with just asking a question here and usually
people are pretty good about helping out with answers when
possible.
On Thursday, 24 October 2019 at 16:20:20 UTC, jmh530 wrote:
On Thursday, 24 October 2019 at 16:03:26 UTC, Dukc wrote:
[snip]
If they are only opening it in Excel, then you can lock cells.
You should be able to do that with VBA.
At least I know it works with xlsx files. Not sure on csv now
On Thursday, 24 October 2019 at 16:03:26 UTC, Dukc wrote:
[snip]
If they are only opening it in Excel, then you can lock cells.
You should be able to do that with VBA.
On Thursday, 24 October 2019 at 17:41:21 UTC, Dukc wrote:
This was wrong: Atila's Excel-d enables writing plugin
functions, but not reading the spreadsheets. There are other
DUB utilities for that, though.
I quess I will give my employer two options: Either the price
variables are in an on
On Tuesday, 29 October 2019 at 08:45:15 UTC, mipri wrote:
[snip]
-unittest sets the 'unittest' version identifier. So this works:
unittest {
assert(0);
}
version(unittest) {
extern(C) void main() {
static foreach(u; __traits(getUnitTests,
__traits(parent, main)))
On Wednesday, 30 October 2019 at 15:09:40 UTC, jmh530 wrote:
[snip]
I feel like this should be added into the compiler so that it
just works.
Hmm, maybe only when compiled with -main, but I don't think
there's a version for that.
On Wednesday, 30 October 2019 at 18:45:50 UTC, Jacob Carlborg
wrote:
On 2019-10-30 16:09, jmh530 wrote:
I feel like this should be added into the compiler so that it
just works.
This will only run the unit tests in the current modules. The
standard way of running the unit tests will run the
I'm curious what the typical motivation is for using both Travis
CI and Circle CI in a project is.
Thanks.
On Thursday, 14 November 2019 at 17:06:36 UTC, Andre Pany wrote:
[snip]
With the public availability of Github Actions I highly
recommend it if you have open source project on Github. If is
free and works well with D and Dub.
Kind regards
Andre
I'm not that familiar with Github Actions, bu
On Saturday, 16 November 2019 at 09:07:45 UTC, Petar Kirov
[ZombineDev] wrote:
[snip]
Most likely the reason is parallelism. Every CI service offers
a limited amount of agents that can run in parallel, which
limits the number of test matrix combinations that you can run
in a reasonable amount
On Wednesday, 27 November 2019 at 16:16:04 UTC, René Heldmaier
wrote:
Hi,
I'm looking for some basic matrix/vector operations and other
numeric stuff.
I spent quite a lot time in reading through the mir
documentation, but i kinda miss the bigger picture. I'm not a
Python user btw. (I know C
On Friday, 21 February 2020 at 11:53:02 UTC, Ali Çehreli wrote:
[snip]
auto byColumn(R)(R range, size_t n) {
return Column!R(range, n);
}
mir has byDim for something similar (numir also has alongDim).
This is how you would do it:
import mir.ndslice;
void main() {
auto x = [0.0, 1.4, 1.
On Friday, 21 February 2020 at 14:43:37 UTC, jmh530 wrote:
[snip]
Actually, I kind of prefer the relevant line as
x.byDim!1[0].each!"a -= 2";
which makes it a little clearer that you can easily change [0] to
[1] to apply each to the second column instead.
On Saturday, 22 February 2020 at 08:29:32 UTC, 9il wrote:
[snip]
Maybe mir.series [1] can work for you.
I had a few other thoughts after looking at septc's solution of
using
y[0..$, 0] *= 100;
to do the calculation.
1) There is probably scope for an additional select function to
handle the
On Thursday, 27 February 2020 at 15:28:01 UTC, p.shkadzko wrote:
On Thursday, 27 February 2020 at 14:15:26 UTC, p.shkadzko wrote:
This works but it does not look very efficient considering we
flatten and then calling array twice. It will get even worse
with 3D arrays.
And yes, benchmarks show
On Thursday, 27 February 2020 at 16:39:15 UTC, 9il wrote:
[snip]
Few performances nitpick for your example to be fair with
benchmarking againt the test:
1. Random (default) is slower then Xorfish.
2. double is twice larger then int and requires twice more
memory, so it would be twice slower th
On Sunday, 1 March 2020 at 20:58:42 UTC, p.shkadzko wrote:
Hello again,
[snip]
What compiler did you use and what flags?
On Monday, 2 March 2020 at 13:35:15 UTC, p.shkadzko wrote:
[snip]
Thanks. I don't have time right now to review this thoroughly. My
recollection is that the dot product of two matrices is actually
matrix multiplication, correct? It generally makes sense to defer
to other people's implementat
On Monday, 2 March 2020 at 18:17:05 UTC, p.shkadzko wrote:
[snip]
I tested @fastmath and @optmath for toIdx function and that
didn't change anyting.
@optmath is from mir, correct? I believe it implies @fastmath.
The latest code in mir doesn't have it doing anything else at
least.
On Monday, 2 March 2020 at 20:22:55 UTC, p.shkadzko wrote:
[snip]
Interesting growth of processing time. Could it be GC?
+--+-+
| matrixDotProduct | time (sec.) |
+--+-+
| 2x[100 x 100]|0.01 |
| 2x[1000 x 1000] |2.21 |
On Tuesday, 3 March 2020 at 10:25:27 UTC, maarten van damme wrote:
it is difficult to write an efficient matrix matrix
multiplication in any language. If you want a fair comparison,
implement your naive method in python and compare those timings.
[snip]
And of course there's going to be a big
On Tuesday, 10 March 2020 at 23:31:55 UTC, p.shkadzko wrote:
[snip]
Below does the same thing as the numpy version.
/+dub.sdl:
dependency "mir-algorithm" version="~>3.7.18"
+/
import mir.ndslice.sorting : sort;
import mir.ndslice.topology : byDim;
import mir.ndslice.slice : sliced;
void main(
On Wednesday, 11 March 2020 at 06:12:55 UTC, 9il wrote:
[snip]
Almost the same, just fixed import for `each` and a bit polished
/+dub.sdl:
dependency "mir-algorithm" version="~>3.7.18"
+/
import mir.ndslice;
import mir.ndslice.sorting;
import mir.algorithm.iteration: each;
void main() {
au
On Wednesday, 18 March 2020 at 15:10:52 UTC, Виталий Фадеев wrote:
On Wednesday, 18 March 2020 at 13:52:20 UTC, Abby wrote:
I cannot build my app, so I was wondering if there is some
clever way to solve this without hardcoded path to my profile
name.
Thank you very much for your help.
I s
On Friday, 27 March 2020 at 10:57:10 UTC, p.shkadzko wrote:
I decided to write a small blog post about multidimensional
arrays in D on what I learnt so far. It should serve as a brief
introduction to Mir slices and how to do basic manipulations
with them. It started with a small file with snipp
On Wednesday, 8 April 2020 at 18:50:16 UTC, data pulverizer wrote:
On Wednesday, 8 April 2020 at 16:53:05 UTC, Anonymouse wrote:
```
import std.stdio;
@safe:
__gshared int gshared = 42;
void foo(int i = gshared)
{
writeln(i);
}
void main()
{
foo();
}
```
This currently works; `foo`
On Wednesday, 8 April 2020 at 19:29:17 UTC, Anonymouse wrote:
[snip]
It works with `ref int` too.
```
__gshared int gshared = 42;
void foo(ref int i = gshared) @safe
{
++i;
}
void main()
{
assert(gshared == 42);
foo();
assert(gshared == 43);
}
```
Well that definitely should
In the code below, I multiply some slice by 5 and then check
whether it equals another slice. This fails for mir's approxEqual
because the two are not the same types (yes, I know that isClose
in std.math works). I was trying to convert the y variable below
to have the same double* iterator as t
On Thursday, 16 April 2020 at 19:59:57 UTC, Basile B. wrote:
[snip]
And remove the extra assert() BTW... I don't know why this is
accepted.
Thanks, I hadn't realized about approxEqual. I think that
resolves my near-term issue, I would need to play around with
things a little more to be 100%
On Sunday, 19 April 2020 at 17:07:36 UTC, p.shkadzko wrote:
I'd like to calculate XX^T where X is some [m x n] matrix.
// create a 3 x 3 matrix
Slice!(double*, 2LU) a = [2.1, 1.0, 3.2, 4.5, 2.4, 3.3, 1.5, 0,
2.1].sliced(3, 3);
auto b = a * a.transposed; // error
Looks like it is not possible
On Sunday, 19 April 2020 at 17:55:06 UTC, p.shkadzko wrote:
snip
So, lubeck mtimes is equivalent to NumPy "a.dot(a.transpose())".
There are elementwise operation on two matrices of the same size
and then there is matrix multiplication. Two different things.
You had initially said using an mx
On Sunday, 19 April 2020 at 19:20:28 UTC, p.shkadzko wrote:
[snip]
well no, "assumeContiguous" reverts the results of the
"transposed" and it's "a * a".
I would expect it to stay transposed as NumPy does "assert
np.all(np.ascontiguous(a.T) == a.T)".
Ah, you're right. I use it in other places
On Sunday, 19 April 2020 at 20:29:54 UTC, p.shkadzko wrote:
[snip]
Thanks. I somehow missed the whole point of "a * a.transposed"
not working because "a.transposed" is not allocated.
a.transposed is just a view of the original matrix. Even when I
tried to do a raw for loop I ran into issues
On Thursday, 16 April 2020 at 20:59:36 UTC, jmh530 wrote:
[snip]
/+dub.sdl:
dependency "mir-algorithm" version="~>3.7.28"
+/
import mir.ndslice;
void foo(Iterator, SliceKind kind)(Slice!(Iterator, 1, kind) x,
Slice!(Iterator, 1, kind) y) {
import std.stdio : writeln;
writeln("here");
On Monday, 20 April 2020 at 00:27:40 UTC, 9il wrote:
[snip]
Using two arguments Iterator1, Iterator2 works without
allocation
/+dub.sdl: dependency "mir-algorithm" version="~>3.7.28" +/
import mir.ndslice;
void foo(Iterator1, Iterator2, SliceKind kind)
(Slice!(Iterator1, 1, kind) x,
On Monday, 20 April 2020 at 19:06:53 UTC, p.shkadzko wrote:
[snip]
It is. I was trying to calculate the covariance matrix of some
dataset X which would be XX^T.
Incorrect. The covariance matrix is calculated with matrix
multiplication, not element-wise multiplication. For instance, I
often
I was trying to write a function has different behavior depending
on whether it is called from @nogc code or not. However, I am
noticing that this does not seem possible because of the timing
of attribute inference.
If I call getFunctionAttributes within foo below, then it is
system but then
When using a template with multiple functions within it, is it
possible to access the underlying functions directly? Not sure I
am missing anything, but what works when the functions are named
differently from the headline template doesn't work when the
functions are named the same.
import st
On Monday, 27 April 2020 at 17:40:06 UTC, Steven Schveighoffer
wrote:
[snip]
Thanks for that. Very detailed.
In terms of a use case, we just added a center function to mir
[1]. It can take an alias to a function. I wanted to add a check
that the arity of the function was 1, but it turned out
On Friday, 1 May 2020 at 15:42:54 UTC, Baby Beaker wrote:
There is a Python eval() equivalent in Dlang working in Runtime?
You might find arsd's script.d interesting [1], but it's more
like a blend between D and javascript.
[1]https://github.com/adamdruppe/arsd/blob/d0aec8e606a90c005b9cac6fcf
I am curious how ctfe and static ifs interact. In particular, if
an enum bool passed as a template parameter or run-time one will
turn an if statement into something like a static if statement
(perhaps after the compiler optimizes other code away). In the
code below, I am a function that takes
On Thursday, 7 May 2020 at 15:29:01 UTC, H. S. Teoh wrote:
[snip]
You explained things very well, thanks.
On Thursday, 7 May 2020 at 15:34:21 UTC, ag0aep6g wrote:
[snip]
The `static if` is guaranteed to be evaluated during
compilation. That means, `foo!y0` effectively becomes this:
auto foo(int rt) { return rt + 1; }
There is no such guarantee for `foo(rt, y0)`. It doesn't matter
that y0 is
On Thursday, 7 May 2020 at 17:59:30 UTC, Paul Backus wrote:
On Thursday, 7 May 2020 at 15:00:18 UTC, jmh530 wrote:
Does foo!y0(rt) generate the same code as foo(rt, y0)?
How is the code generated by foo(rt, x0) different from
foo(rt,y0)?
You can look at the generated code using the Compiler
On Sunday, 24 May 2020 at 14:21:26 UTC, Pavel Shkadzko wrote:
[snip]
Sorry for the typo. It should be "auto arrSlice = a.sliced;"
Try using fuse
/+dub.sdl:
dependency "mir-algorithm" version="*"
+/
import std.stdio;
import std.conv;
import std.array: array;
import std.range: chunks;
import mi
The following code results in the static assert in the
constructor being triggered, even though I would have thought no
constructor would have been called. I know that there is an easy
fix for this (move the static if outside the constructor), but it
still seems like it doesn't make sense.
en
On Sunday, 24 May 2020 at 21:43:34 UTC, H. S. Teoh wrote:
On Sun, May 24, 2020 at 09:34:53PM +, jmh530 via
Digitalmars-d-learn wrote:
The following code results in the static assert in the
constructor being triggered, even though I would have thought
no constructor would have been called
On Tuesday, 26 May 2020 at 15:16:25 UTC, jmh530 wrote:
[snip]
Another short-term fix might be to try compiling with the -m32
dflag (need to put in your dub.sdl/json).
Sorry, easier is
dub test --arch=x86
On Wednesday, 13 May 2020 at 15:26:48 UTC, BoQsc wrote:
[snip]
Linking...
lld-link: error: could not open libcmt.lib: no such file or
directory
lld-link: error: could not open OLDNAMES.lib: no such file or
directory
Error: linker exited with status 1
C:\D\dmd2\windows\bin\dmd.exe failed with
1 - 100 of 448 matches
Mail list logo