On Tuesday, 1 October 2024 at 17:30:20 UTC, H. S. Teoh wrote:
On Tue, Oct 01, 2024 at 04:30:27PM +, Salih Dincer wrote:
Please add this to your MyCon structure:
```d
alias value this;
// assert(num1 == 3.14);
```
And test it like this too, I think it's awesome!
[...]
IMO it's not a good id
On Tue, Oct 01, 2024 at 04:30:27PM +, Salih Dincer via Digitalmars-d-learn
wrote:
[...]
> > ```
> Please add this to your MyCon structure:
> ```d
> alias value this;
> // assert(num1 == 3.14);
> ```
> And test it like this too, I think it's awesome!
[...]
IMO it's not a good idea to recommend
On Tuesday, 1 October 2024 at 16:18:17 UTC, Salih Dincer wrote:
```d
// ...
struct MyCon
{
string input;
T value;
this(string data)
{
// ...
}
// ...
}
}
```
Please add this to your MyCon structure:
```d
alias value this;
// assert(num1 == 3
On Tuesday, 1 October 2024 at 01:00:08 UTC, Andy Valencia wrote:
... A conversion like:
auto d = atoi!double("123.456");
is about 4k of code. Nice!
Congratulations on your initiative. D is very flexible with
templates, especially with the mixin templates. For example, you
might like t
On Tuesday, 1 October 2024 at 11:45:35 UTC, monkyyy wrote:
On Tuesday, 1 October 2024 at 05:44:16 UTC, H. S. Teoh wrote:
why spend the time and effort when you could have just done:
```
import std.conv;
theres a bunch of relivent tradeoffs and phoboes doesnt make a
good set of them
To be f
On Tuesday, 1 October 2024 at 05:44:16 UTC, H. S. Teoh wrote:
why spend the time and effort when you could have just done:
```
import std.conv;
theres a bunch of relivent tradeoffs and phoboes doesnt make a
good set of them
On Tue, Oct 01, 2024 at 01:00:08AM +, Andy Valencia via Digitalmars-d-learn
wrote:
> I had an old atoi() I wrote when I was getting started with D. You know,
> fixed type, string in, int output. Today for fun I templated the type:
>
> T atoi(T)(string s)
[...]
It's all good and fun to try
On Saturday, 18 March 2023 at 20:42:50 UTC, Nick Treleaven wrote:
On Saturday, 18 March 2023 at 19:22:07 UTC, Chris Katko wrote:
...
So there's multiple sub-problems to solve. I asked this years
ago, and got 90% of the way done and then lost the code and
cannot find the original forum post.
On Saturday, 18 March 2023 at 19:22:07 UTC, Chris Katko wrote:
...
So there's multiple sub-problems to solve. I asked this years
ago, and got 90% of the way done and then lost the code and
cannot find the original forum post.
Maybe it was this?:
https://forum.dlang.org/post/dqzxnctucwvyhstfz
On 9/20/21 6:16 PM, rjkilpatrick wrote:
Essentially, I would like to write a template that calls the constructor
of the parent class or the constructor of the inherited class, depending
on its type.
...
Some kind of `return new this(...)` would be good, but that's not possible.
I think it
On Monday, 20 September 2021 at 22:16:47 UTC, rjkilpatrick wrote:
auto opBinary(string op)(int rhs) const if (op == "+") {
return new Super(_a + rhs); // Creates of type Super
even when called from derived class
}
Make this
auto opBinary(string op, this This)(int rhs) ...
I think I will dedicate tonight one or two hours to understand
the first two proposals :-D.
On Thursday, 24 September 2020 at 13:28:25 UTC, WebFreak001 wrote:
[...]
Alternatively a lot easier would be to just return auto and do:
auto dt(alias fun, T)(Dot!T t){
return t.dot(t => unaryFu
On Thursday, 24 September 2020 at 14:15:01 UTC, ddcovery wrote:
[...]
I think I will dedicate tonight one or two hours to understand
the first two proposals :-D.
[...]
Not necessary, really simple and well explained WebFreak001!!!
On Thursday, 24 September 2020 at 11:15:11 UTC, ddcovery wrote:
[...]
Example: I tried with a global function
Dot!R dt(alias fun, T, R)(Dot!T t){
auto f = cast(R function(T)) unaryFun!fun;
return t.dot!R(f);
}
[...]
the problem is the template can't automatically determine the
type "R". A
On Wednesday, 22 July 2020 at 22:21:47 UTC, Dennis wrote:
On Wednesday, 22 July 2020 at 21:58:16 UTC, Cecil Ward wrote:
I need to then work out what is the size of the internal units
within the 128-bit value, size in bytes,1 or 2, at compile
time.
You can use the .sizeof property on the type.
On Wednesday, 22 July 2020 at 21:58:16 UTC, Cecil Ward wrote:
I need to then work out what is the size of the internal units
within the 128-bit value, size in bytes,1 or 2, at compile time.
You can use the .sizeof property on the type.
```
import core.simd;
void main() {
ubyte16 a;
ush
On 04/10/2019 05:07 AM, Ron Tarrant wrote:
>> the book's index:
>>
>> http://ddili.org/ders/d.en/ix.html
> Oops!
Not at all. One of the most useful parts of the book has been the index
section for me. I occasionally search in there... like just yesterday
for the positional format specifier
On Wednesday, 10 April 2019 at 00:42:11 UTC, Ali Çehreli wrote:
Your code did not work because Point is not a type but a type
template. (On the other hand, Point!double is a type). The
whole program:
Thanks very much, Ali! Obviously, I've got some studying ahead of
me.
On Wednesday, 10 April 2019 at 00:22:47 UTC, Ali Çehreli wrote:
On 04/08/2019 05:23 AM, Ron Tarrant wrote:
> But in "Programming in D," (self, 2009-2018) by Ali Çehreli,
there's no
> mention of the 'template' keyword in any of his examples.
'template' keyword is introduced here:
http://ddil
On Tuesday, 9 April 2019 at 20:48:45 UTC, Steven Schveighoffer
wrote:
The thing that made it click for me is that a template is very
akin to a macro substitution -- where you just copy and paste
the given parameter wherever its substitute is found.
Nicely put. Thanks, Steve. I at least get t
On Wednesday, 10 April 2019 at 00:42:11 UTC, Ali Çehreli wrote:
(It may be made to work with Adam's (T : Point!R, R) syntax but
I failed just now.)
You know, I didn't think T : Point!T would work, but it does. Huh.
Anyway, the , R one works similarly, observe:
---
T getResponse(T : Point!R, R
On 04/08/2019 05:59 AM, Ron Tarrant wrote:
On Monday, 8 April 2019 at 12:40:10 UTC, Adam D. Ruppe wrote:
You don't need template keyword for the majority of cases because the
compiler lets you do shortcuts.
Thanks, Adam. Good to know.
(maybe I am looking at the wrong part of the book, it is
On 04/08/2019 05:23 AM, Ron Tarrant wrote:
> But in "Programming in D," (self, 2009-2018) by Ali Çehreli, there's no
> mention of the 'template' keyword in any of his examples.
'template' keyword is introduced here:
http://ddili.org/ders/d.en/templates_more.html#ix_templates_more.template
I
On Tue, Apr 09, 2019 at 04:48:45PM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 4/9/19 4:31 PM, Ron Tarrant wrote:
>
> > I'm still struggling to understand templates, but I'll keep at it.
[...]
> The thing that made it click for me is that a template is very akin to
> a macro s
On 4/9/19 4:31 PM, Ron Tarrant wrote:
I'm still struggling to understand templates, but I'll keep at it.
When I first saw C++ templates, I thought "what the hell is this black
magic", and had no idea how they worked. In fact, this was back before
STL, and I recall it was a set of templates c
On Tuesday, 9 April 2019 at 14:41:30 UTC, Alex wrote:
Your confusion arises in your understanding of meta programming
and templates. Templates are compile time expressions that use
parameters.
This sounds like another 'no.' :)
Thanks for all the info, Alex.
On Tuesday, 9 April 2019 at 14:25:18 UTC, Mike Parker wrote:
Off the top of my head, to get a Singleton template, you could
implement all of your singleton plumbing (thread safety if you
need it, etc) in the template and add a `static _instance`
member just as you would for any non-templated s
On Monday, 8 April 2019 at 12:23:28 UTC, Ron Tarrant wrote:
I'm digging into templates in an attempt to understand the
signals-n-slots replacement for the observer pattern, but I've
got a question I can't seem to find an answer for and an
example for which I'm unable to solve the error.
First
On Tuesday, 9 April 2019 at 10:53:49 UTC, Ron Tarrant wrote:
On Monday, 8 April 2019 at 14:56:46 UTC, Mike Parker wrote:
In the subsequent sections, I show both long and short
(eponymous) forms of enum and function templates.
In your book, Mike, you stated:
Remember, a template is only insta
On Monday, 8 April 2019 at 14:56:46 UTC, Mike Parker wrote:
In the subsequent sections, I show both long and short
(eponymous) forms of enum and function templates.
In your book, Mike, you stated:
Remember, a template is only instantiated once for each set of
arguments and
the same instantia
On Monday, 8 April 2019 at 14:56:46 UTC, Mike Parker wrote:
In the subsequent sections, I show both long and short
(eponymous) forms of enum and function templates.
Forgot to say...
I'm typing in the examples as I go and so far I haven't been
lost. Even when you don't come right out and say
On Monday, 8 April 2019 at 14:56:46 UTC, Mike Parker wrote:
You should have read further along in that chapter :-)
LOL! Actually, after reading Adam's reply, I dug back into your
book and I'm starting to get a reasonable handle on this. I must
say, I like the slow-but-steady intro you wrote.
On Monday, 8 April 2019 at 12:23:28 UTC, Ron Tarrant wrote:
First, the question...
In Michael Parker's book, "Learning D," (Packt, 2015) on page
160 he gives an example of a basic template:
template MyTemplate(T)
{
T val;
void printVal()
{
import std.stdio : writeln;
wr
On Monday, 8 April 2019 at 12:40:10 UTC, Adam D. Ruppe wrote:
You don't need template keyword for the majority of cases
because the compiler lets you do shortcuts.
Thanks, Adam. Good to know.
(maybe I am looking at the wrong part of the book, it is hard
to find the right section/page number
On Monday, 8 April 2019 at 12:23:28 UTC, Ron Tarrant wrote:
But in "Programming in D," (self, 2009-2018) by Ali Çehreli,
there's no mention of the 'template' keyword in any of his
examples.
You don't need template keyword for the majority of cases because
the compiler lets you do shortcuts.
On Saturday, 6 January 2018 at 23:32:42 UTC, Paul Backus wrote:
On Saturday, 6 January 2018 at 03:38:35 UTC, codephantom wrote:
or even..
a.append( s.to!ConvertToElementType(a) );
That's not valid code of course, but the semantics are all
contained in that single chunk.
This works:
import
On Saturday, 6 January 2018 at 23:32:42 UTC, Paul Backus wrote:
On Saturday, 6 January 2018 at 03:38:35 UTC, codephantom wrote:
or even..
a.append( s.to!ConvertToElementType(a) );
That's not valid code of course, but the semantics are all
contained in that single chunk.
This works:
import
On Saturday, 6 January 2018 at 03:38:35 UTC, codephantom wrote:
or even..
a.append( s.to!ConvertToElementType(a) );
That's not valid code of course, but the semantics are all
contained in that single chunk.
This works:
import std.range.primitives: ElementType;
a ~= s.to!(ElementType!(typeo
On Saturday, 6 January 2018 at 03:08:19 UTC, Ali Çehreli wrote:
I agree with your point as well.
A better name can help there a little.
void ConvertAndAppend(T, S)(ref T[] arr, S s) {
arr ~= s.to!T;
}
problem solved ;-)
btw. I never thought that I would be able (or actually..willing)
On Saturday, 6 January 2018 at 03:08:19 UTC, Ali Çehreli wrote:
It's hard to find a balance between fully explicit and fully
automatic. I find myself going back and forth between those two
extremes.
Ali
Code is something that humans write and read (and read far more
than write).
So I pref
On 01/05/2018 06:14 PM, codephantom wrote:
> On Saturday, 6 January 2018 at 01:33:11 UTC, Ali Çehreli wrote:
>> One solution is to wrap ~= in a function template. Now the conversion
>> is automatically made to the element type of the array:
>> ...
>> .
>> I think append() could be a part of st
On Saturday, 6 January 2018 at 01:33:11 UTC, Ali Çehreli wrote:
One solution is to wrap ~= in a function template. Now the
conversion is automatically made to the element type of the
array:
...
.
I think append() could be a part of std.array but I can't find
anything like that in Phobos.
15.12.2017 11:49, yes9111 пишет:
Hey Y'all,
I'm trying to write a simple utility class to read rows from a SQLite3
database using compile time parameters, but I've run into a weird problem.
https://pastebin.com/eTnbRjEd
If I try to instantiate a Reader class I'm hitting a linker error saying
On Fri, 2016-09-09 at 12:22 +, Kagamin via Digitalmars-d-learn
wrote:
> On Thursday, 8 September 2016 at 10:26:04 UTC, Russel Winder
> wrote:
> >
> > >
> > > Do they use single assignment a lot?
> >
> > Python has no notion of single assignment. Exactly the
> > opposite, Python allows ever
On Fri, 2016-09-09 at 14:20 +, jmh530 via Digitalmars-d-learn
wrote:
> […]
>
> What I mean is that Chapel doesn't have a lot of libraries (also
> true for D, but things are getting better). If I'm going to do
> some analysis, it usually takes much less time for me to do it in
> R/Python/Mat
On Thu, 2016-09-08 at 15:45 +, deXtoRious via Digitalmars-d-learn
wrote:
>
[…]
> It's very early days for Chapel at the moment, but I don't really
> see it as being remotely comparable to D or even Julia, it's much
> closer to a DSL than a general purpose language. That's by no
> means a ba
On Friday, 9 September 2016 at 13:32:16 UTC, Russel Winder wrote:
Why write algorithms in C or C++ when you can do it in Chapel?
For the moment, the objective answers to that question seem: you
need GPGPU (especially CUDA, which is vastly more convenient to
use from C++ than from anything els
On Friday, 9 September 2016 at 13:32:16 UTC, Russel Winder wrote:
Should we be giving up on D and switching to Sparrow?
Most certainly not! I don't think it has to be either D or
Sparrow. There is a quote liked from one of Walter's
presentation. Someone asked the question:
"What happens whe
On Friday, 9 September 2016 at 13:24:18 UTC, Russel Winder wrote:
For computational work I'd say Chapel was just as productive as
any other language, probably better. This is though likely an
issue on which there is only opinion and no facts.
GPGPU support is not in Chapel as yet I believe,
On Thu, 2016-09-08 at 14:39 +, data pulverizer via Digitalmars-d-
learn wrote:
> […]
>
> I can see where you are coming from, I have taken a look at
> Chapel and high performance computing is their top priority. I
> think they hope that it will be the next Fortran, but I think it
> is very
On Thu, 2016-09-08 at 13:09 +, jmh530 via Digitalmars-d-learn
wrote:
> On Thursday, 8 September 2016 at 10:18:36 UTC, Russel Winder
> wrote:
> >
> >
> > I am certainly hoping that Chapel will be the language to
> > displace NumPy for serious computation in the Python-sphere.
> > Given it's
On Thursday, 8 September 2016 at 10:26:04 UTC, Russel Winder
wrote:
Do they use single assignment a lot?
Python has no notion of single assignment. Exactly the
opposite, Python allows everything to be changed at any time.
Then you probably shouldn't pitch them alien concepts?
On Thursday, 8 September 2016 at 10:20:42 UTC, Russel Winder
wrote:
On Wed, 2016-09-07 at 20:29 +, deXtoRious via
Digitalmars-d-learn wrote:
[…]
More to the general point of the discussion, I find that most
scientifically minded users of Python already appreciate some
of the inherent adv
On Thursday, 8 September 2016 at 10:18:36 UTC, Russel Winder
wrote:
I am certainly hoping that Chapel will be the language to
displace NumPy for serious computation in the Python-sphere.
Given it's foundation in the PGAS model, it has all the
parallelism needs, both cluster and local, built in.
On Thursday, 8 September 2016 at 10:18:36 UTC, Russel Winder
wrote:
I am certainly hoping that Chapel will be the language to
displace NumPy for serious computation in the Python-sphere.
Given it's foundation in the PGAS model, it has all the
parallelism needs, both cluster and local, built i
On Wed, 2016-09-07 at 16:21 +, Kagamin via Digitalmars-d-learn
wrote:
> On Wednesday, 7 September 2016 at 11:37:44 UTC, Russel Winder
> wrote:
> >
> > The real problem though is the terrifying error message. I am
> > having a hard time finding a way of pitching them to
> > Pythonistas.
>
>
On Wed, 2016-09-07 at 20:29 +, deXtoRious via Digitalmars-d-learn
wrote:
>
[…]
> More to the general point of the discussion, I find that most
> scientifically minded users of Python already appreciate some of
> the inherent advantages of lower level statically typed languages
> and often r
On Wed, 2016-09-07 at 20:29 +, jmh530 via Digitalmars-d-learn
wrote:
>
[…]
> Are you familiar with Chapel at all? The language allows the user
> to specify a domain with an array, facilitating sparsity or
> arrays distributed across different machines. For some reason I
> was reminded of th
On Wednesday, 7 September 2016 at 21:41:20 UTC, data pulverizer
wrote:
Yes, but from a usability point of view this would be very poor
- forcing the user to create a new variable each time they
modified a table. I am aware that databases do this but it is
hidden away.
To be fair, you can
On Wednesday, 7 September 2016 at 21:33:25 UTC, pineapple wrote:
Fuck it, I took an hour to document the most significant
modules.
https://github.com/pineapplemachine/mach.d/tree/master/mach/range
Looks like a step in the right direction!
On Wednesday, 7 September 2016 at 22:11:05 UTC, data pulverizer
wrote:
On Wednesday, 7 September 2016 at 20:57:15 UTC, bachmeier wrote:
I too come from the R world and I have been playing the game
of flitting between R and C++; using C++ (through RCpp) to
speed up slow things in R for some time
On Wednesday, 7 September 2016 at 20:57:15 UTC, bachmeier wrote:
I too come from the R world and I have been playing the game
of flitting between R and C++; using C++ (through RCpp) to
speed up slow things in R for some time and I have been
looking for a better solution.
What are you doing wi
On Wednesday, 7 September 2016 at 21:25:30 UTC, jmh530 wrote:
Consider a potential use case. You have an existing data frame
and you want to add a column of data to it that has a different
type than the existing frame. I imagine the function call would
look something like:
auto newFrame = oldF
On Wednesday, 7 September 2016 at 20:29:42 UTC, jmh530 wrote:
Thanks for the reply. It looks like an interesting idea. You
might consider adding this (or a modified version) to a read me
in the range subfolder.
Fuck it, I took an hour to document the most significant modules.
https://github.c
On Wednesday, 7 September 2016 at 20:49:42 UTC, data pulverizer
wrote:
You're quite right that D doesn't need to change at all to
implement something like pandas or dataframes in R, but I am
thinking of how to got further. Very often in data science
applications types will turn up that are re
On Wednesday, 7 September 2016 at 21:07:20 UTC, data pulverizer
wrote:
Don't get me wrong, I still think Julia is a very cool
language. My opinion is that we should have more languages.
Let me correct myself ... I think that hyper-meta-programming as
in Sparrow could certainly revolutionize co
On Wednesday, 7 September 2016 at 21:01:59 UTC, deXtoRious wrote:
That's just typical press nonsense, and even they quote
Bezanson saying how Julia isn't at all suited to a whole host
of applications. Julia certainly has (justifiable, imho, though
only time will tell) aspirations of being use
On Wednesday, 7 September 2016 at 21:01:59 UTC, deXtoRious wrote:
That's just typical press nonsense, and even they quote
Bezanson saying how Julia isn't at all suited to a whole host
of applications. Julia certainly has (justifiable, imho, though
only time will tell) ...
Don't get me wrong,
On Wednesday, 7 September 2016 at 20:57:03 UTC, data pulverizer
wrote:
On Wednesday, 7 September 2016 at 20:29:51 UTC, deXtoRious
wrote:
On Wednesday, 7 September 2016 at 19:19:23 UTC, data
pulverizer wrote:
The "One language to rule them all" motif of Julia has hit
the rocks; one reason is bec
On Wednesday, 7 September 2016 at 20:57:15 UTC, bachmeier wrote:
What are you doing with Rcpp that you can't do with D?
That's a very good point, there's nothing that R + C++ can do
that is out of D's reach. But, I wander if we can go further
On Wednesday, 7 September 2016 at 19:19:23 UTC, data pulverizer
wrote:
On Wednesday, 7 September 2016 at 15:04:38 UTC, jmh530 wrote:
On Wednesday, 7 September 2016 at 11:37:44 UTC, Russel Winder
wrote:
I really don't see what's not working in this.
Trying to get new D users from Python user
On Wednesday, 7 September 2016 at 20:29:51 UTC, deXtoRious wrote:
On Wednesday, 7 September 2016 at 19:19:23 UTC, data pulverizer
wrote:
The "One language to rule them all" motif of Julia has hit the
rocks; one reason is because they now realize that their
language is being held back because th
On Wednesday, 7 September 2016 at 20:37:50 UTC, jmh530 wrote:
On Wednesday, 7 September 2016 at 19:19:23 UTC, data pulverizer
I don't see any reason why D can't implement pandas DataFrames
without needing to change the language at all
http://pandas.pydata.org/pandas-docs/stable/generated/pandas
On Wednesday, 7 September 2016 at 20:37:50 UTC, jmh530 wrote:
On Wednesday, 7 September 2016 at 19:19:23 UTC, data pulverizer
wrote:
For some time I have been considering a problem to do with
creating tables with unbounded types, one of the failed
attempts is here:
https://forum.dlang.org/th
On Wednesday, 7 September 2016 at 19:19:23 UTC, data pulverizer
wrote:
For some time I have been considering a problem to do with
creating tables with unbounded types, one of the failed
attempts is here:
https://forum.dlang.org/thread/gdjaoxypicsxlfvzw...@forum.dlang.org?page=1
I then exchang
On Wednesday, 7 September 2016 at 19:19:23 UTC, data pulverizer
wrote:
The "One language to rule them all" motif of Julia has hit the
rocks; one reason is because they now realize that their
language is being held back because the compiler cannot infer
certain types for example:
http://www.joh
On Wednesday, 7 September 2016 at 18:55:41 UTC, pineapple wrote:
So the first difference you're likely to notice is that it's
not as well documented. (Sorry. I'm a busy woman. I'll get
around to it.) I try to make up for it with copious unit tests,
which should provide a good example for how
On Wednesday, 7 September 2016 at 15:04:38 UTC, jmh530 wrote:
On Wednesday, 7 September 2016 at 11:37:44 UTC, Russel Winder
wrote:
I really don't see what's not working in this.
Trying to get new D users from Python users is the main
problem.
I came to D from Python/R/Matlab. The bigges
On Wednesday, 7 September 2016 at 18:22:39 UTC, jmh530 wrote:
On Wednesday, 7 September 2016 at 18:10:45 UTC, pineapple wrote:
You might want to check out the ranges package of the library
I'm working on.
https://github.com/pineapplemachine/mach.d/tree/master/mach/range
There's a lot of s
On Wednesday, 7 September 2016 at 18:10:45 UTC, pineapple wrote:
You might want to check out the ranges package of the library
I'm working on.
https://github.com/pineapplemachine/mach.d/tree/master/mach/range
There's a lot of stuff there. Do you mind giving a TL;DR version
of what your ra
On Tuesday, 6 September 2016 at 14:38:54 UTC, Russel Winder wrote:
and I have no idea just now why it is complaining, nor what to
do to fix it.
You might want to check out the ranges package of the library I'm
working on.
https://github.com/pineapplemachine/mach.d/tree/master/mach/range
Thi
On Wednesday, 7 September 2016 at 11:37:44 UTC, Russel Winder
wrote:
The real problem though is the terrifying error message. I am
having a hard time finding a way of pitching them to
Pythonistas.
Do they use single assignment a lot?
On Wednesday, 7 September 2016 at 11:37:44 UTC, Russel Winder
wrote:
I really don't see what's not working in this.
Trying to get new D users from Python users is the main problem.
I came to D from Python/R/Matlab. The biggest issue for me wasn't
error messages so much as the lack of good
On Wednesday, 7 September 2016 at 11:37:44 UTC, Russel Winder
wrote:
I'd prefer immutable, but const sometimes has to do. The idea
is to find out how to enforce single assignment in D.
Everything depends on what you mean by "single assignment".
If you mean "I can't use opAssign", then const is
On Wednesday, 7 September 2016 at 11:33:08 UTC, Russel Winder
wrote:
C++, error messages
sorry, i loled hard.
On Wed, 2016-09-07 at 09:04 +, Lodovico Giaretta via Digitalmars-d-
learn wrote:
>
[…]
> You have your const fixed-length array. You slice it and you
> obtain a const range to feed map. Now map will not return you an
> array. Because most of the time you don't need it. It will return
> you
On Wed, 2016-09-07 at 09:03 +, ketmar via Digitalmars-d-learn
wrote:
> […]
>
> alas, no jokes here. within the current D sytnax there is simply
> no way to make that error less cryptic. :-(
Well that will be the end of any traction for D then. C++, Java,
Groovy, etc. error messages prove tha
On Wed, 2016-09-07 at 20:32 +1200, rikki cattermole via Digitalmars-d-
learn wrote:
>
[…]
> Ok, I have it mostly compiling.
>
> void run_mean() {}
> void run_mode() {}
> void run_stdDev() {}
For my code the functions have to be declared within the main function
rather than being at module level.
On Wed, 2016-09-07 at 08:42 +, Kagamin via Digitalmars-d-learn
wrote:
> https://dpaste.dzfl.pl/0b436b240e3c
But now try adding the writeln function. Then you get the errors.
--
Russel.
=
Dr Russel Winder t: +44
On Wednesday, 7 September 2016 at 08:19:39 UTC, Russel Winder
wrote:
On Tue, 2016-09-06 at 14:50 +, Lodovico Giaretta via
Digitalmars-d- learn wrote:
[…]
From a quick look, it looks like `results` is a
`const(TickDuration[3])`, that is a fixed-length array. And
fixed-length arrays aren'
On Wednesday, 7 September 2016 at 08:30:51 UTC, Russel Winder
wrote:
On Tue, 2016-09-06 at 14:53 +, ketmar via
Digitalmars-d-learn wrote:
[…]
exactly. static arrays doesn't have `popFront`, hence
`isInputRange` fails. yet there is no way to tell that to
user, so one should just learn wha
https://dpaste.dzfl.pl/0b436b240e3c
On 07/09/2016 2:38 AM, Russel Winder via Digitalmars-d-learn wrote:
The code fragment:
const results = benchmark!(run_mean, run_mode, run_stdDev)(1);
const times = map!((TickDuration t) { return
(to!Duration(t)).total!"seconds"; })(results);
seems entirely reasonable to me. How
On Tue, 2016-09-06 at 14:53 +, ketmar via Digitalmars-d-learn
wrote:
>
[…]
> exactly. static arrays doesn't have `popFront`, hence
> `isInputRange` fails. yet there is no way to tell that to user,
> so one should just learn what those cryptic error messages really
> means.
I shall assume a
On Tue, 2016-09-06 at 14:50 +, Lodovico Giaretta via Digitalmars-d-
learn wrote:
>
[…]
> From a quick look, it looks like `results` is a
> `const(TickDuration[3])`, that is a fixed-length array. And
> fixed-length arrays aren't ranges. If you explicitly slice them,
> they become dynamic ar
On Tuesday, 6 September 2016 at 14:50:17 UTC, Lodovico Giaretta
wrote:
From a quick look, it looks like `results` is a
`const(TickDuration[3])`, that is a fixed-length array. And
fixed-length arrays aren't ranges. If you explicitly slice
them, they become dynamic arrays, which are ranges.
So
On Tuesday, 6 September 2016 at 14:38:54 UTC, Russel Winder wrote:
The code fragment:
const results = benchmark!(run_mean, run_mode, run_stdDev)(1);
const times = map!((TickDuration t) { return
(to!Duration(t)).total!"seconds"; })(results);
seems entirely reasonable to me. However rd
On Thursday, 14 July 2016 at 19:48:38 UTC, ag0aep6g wrote:
Make F an alias parameter:
struct Neurons_layer(T = float, size_t neurons_num = 0, alias F
= Sigmoid)
if(isFloatingPoint!T && is(typeof(F!T.Function)))
{
...
private:
alias Function = F!T.Function;
}
unittest
{
On Thursday, 14 July 2016 at 19:48:20 UTC, Lodovico Giaretta
wrote:
You don't need Sigmoid!float at all. This will work:
Neurons_layer!(float, 5) nf;
as you provided a default value for the third argument.
Yes, default init is present, but double, real types are desirable
On Thursday, 14 July 2016 at 19:28:23 UTC, Andrey wrote:
On Thursday, 14 July 2016 at 19:27:14 UTC, Andrey wrote:
[...]
struct Sigmoid(T)
{
[...]
}
struct Neurons_layer(T = float, size_t neurons_num = 0, F =
Sigmoid!T)
if(isFloatingPoint!T && is(typeof(F.Function)))
{
[...]
pri
1 - 100 of 240 matches
Mail list logo