On Monday, 10 April 2023 at 20:31:43 UTC, Steven Schveighoffer
wrote:
On 4/10/23 4:25 PM, Steven Schveighoffer wrote:
It's also completely useless. Having const keys does nothing
to guarantee unchanging keys. Another half-assed attempt to be
encode correct semantics but fails completely in its
It seems that it isn't possible, am I missing something?
alias Q = int[int*];
pragma(msg, Q); // int[const(int)*]
Also, is this documented somewhere?
On Saturday, 16 May 2020 at 19:14:51 UTC, John Colvin wrote:
What's the best way to implement an Objective C protocol in D?
I see mention here
https://dlang.org/changelog/2.085.0.html#4_deprecated_objc_interfaces but it's not clear where things are these days.
Based on some experimentation, I
What's the best way to implement an Objective C protocol in D?
I see mention here
https://dlang.org/changelog/2.085.0.html#4_deprecated_objc_interfaces but it's not clear where things are these days.
On Monday, 14 October 2019 at 19:45:11 UTC, Paul Backus wrote:
On Monday, 14 October 2019 at 17:00:56 UTC, John Colvin wrote:
Different ability to access a property depending if I'm inside
something else when I look?
[snip]
You're attempting to call one of S's member functions without
an in
Different ability to access a property depending if I'm inside
something else when I look?
struct S
{
int a;
static int b;
int c() { return a; }
static int d() { return 3; }
int e() @property { return a; }
static int f() @property { return 3; }
}
void foo(S s)
{
prag
I have a function that allocates a closure somewhere in it (as
shown by the result of -profile=gc).
I can't make the function nogc as it calls a lot of other GC
using code.
profilegc.log only gives me the line number of the function
signature, which doesn't give me any hint as to where in th
On Sunday, 11 August 2019 at 20:15:34 UTC, Alex wrote:
On Sunday, 11 August 2019 at 16:05:20 UTC, John Colvin wrote:
I'm trying to narrow down exactly what patterns work with each
and how they overlap.
What I was trying to get at with the abstract method thing is
that
abstract class C
{
On Sunday, 11 August 2019 at 15:16:03 UTC, Alex wrote:
On Sunday, 11 August 2019 at 13:09:43 UTC, John Colvin wrote:
Ok. What would go wrong (in D) if I just replaced every
interface with an abstract class?
I think there's some confusion here, because B.foo is not
abstract. abstract on a clas
On Saturday, 10 August 2019 at 17:28:32 UTC, Alex wrote:
´´´
void main(){}
interface A { void fun(); }
abstract class B{ void fun(); }
class C : A{ void fun(){} }
class D : B{ /*override*/ void fun(){} }
´´´
case 1:
interface A and class C implementing interface A:
You don't need to "override"
On Saturday, 10 August 2019 at 17:46:37 UTC, Timon Gehr wrote:
On 10.08.19 16:29, John Colvin wrote:
Ok. What would go wrong (in D) if I just replaced every
interface with an abstract class?
interface A{}
interface B{}
class C: A,B{ }
Yes, I know, I guess it wasn't clear unless you read m
On Saturday, 10 August 2019 at 10:11:15 UTC, Alex wrote:
On Saturday, 10 August 2019 at 08:20:46 UTC, John Colvin wrote:
On Friday, 9 August 2019 at 13:39:53 UTC, Simen Kjærås wrote:
Thanks for the extra detail.
Is there a solid reason to ever use an interface over an
abstract class? (Othe
On Saturday, 10 August 2019 at 10:02:02 UTC, Antonio Corbi wrote:
On Saturday, 10 August 2019 at 08:20:46 UTC, John Colvin wrote:
On Friday, 9 August 2019 at 13:39:53 UTC, Simen Kjærås wrote:
Thanks for the extra detail.
Is there a solid reason to ever use an interface over an
abstract cla
On Friday, 9 August 2019 at 13:39:53 UTC, Simen Kjærås wrote:
Thanks for the extra detail.
Is there a solid reason to ever use an interface over an abstract
class? (Other than multiple inheritance).
I'm such a noob at anything related to OO.
On Friday, 9 August 2019 at 13:39:53 UTC, Simen Kjærås wrote:
We're getting into somewhat advanced topics now. This is
described in the Application Binary Interface page of the
documentation[0]. In short: classes and interfaces both use a
vtable[1] that holds pointers to each of their methods.
On Friday, 9 August 2019 at 13:19:14 UTC, kinke wrote:
On Friday, 9 August 2019 at 12:26:59 UTC, John Colvin wrote:
Why is there no "hi" between 0 and 1?
Because you are treating the unadjusted object pointer as
interface pointer and then call the only virtual function of
that interface, in
import std.stdio;
interface I
{
void foo();
}
class C : I
{
override void foo() { writeln("hi"); }
}
abstract class AC
{
void foo();
}
class D : AC
{
override void foo() { writeln("hi"); }
}
void main()
{
auto c = new C();
writeln(0);
(cast(I)cast(void*)c).foo();
On Wednesday, 8 May 2019 at 11:53:34 UTC, Russel Winder wrote:
On Mon, 2019-05-06 at 15:53 +, John Colvin via
Digitalmars-d-learn wrote:
[…]
pretty please show people it with UFCS:
recurrence!((a, n) => a[n-1] + a[n-2])(zero, one)
.dropExactly(n)
.front
Any particular rea
On Monday, 6 May 2019 at 13:05:27 UTC, Russel Winder wrote:
On Sunday, 5 May 2019 at 19:34:05 UTC, Nicholas Wilson wrote:
On Sunday, 5 May 2019 at 19:18:47 UTC, lithium iodate wrote:
[...]
Yep https://run.dlang.io/is/XsLrRz works for me,
https://run.dlang.io/is/KxY0e9 doesn't.
Thanks peopl
On Thursday, 13 July 2017 at 12:49:40 UTC, Per Nordlöw wrote:
Have anybody constructed an idiomatic D wrapper for FFTW?
No, sorry, although I have used the library quite a bit in D.
http://www.fftw.org/fftw3_doc/Tutorial.html#Tutorial
I'm specifically concerned about
- `RefCounted`-wrapping
On Tuesday, 30 May 2017 at 18:05:07 UTC, H. S. Teoh wrote:
On Tue, May 30, 2017 at 05:57:04PM +, Lyle via
Digitalmars-d-learn wrote:
Hi,
I have an associative array of type int[ulong] and I'm trying
to get the index of the maximum value, like this:
int[ulong] aa = [1UL: 2000,
On Wednesday, 10 May 2017 at 01:42:47 UTC, Andrew Edwards wrote:
Attempting to update a git repo to current D, I encounter the
following deprecation messages:
src/glwtf/signals.d-mixin-256(256,2): Deprecation:
glwtf.input.BaseGLFWEventHandler._on_key_down is not visible
from module glwtf.sign
On Friday, 17 March 2017 at 19:08:36 UTC, Russel Winder wrote:
On Fri, 2017-03-17 at 17:51 +, Jerry via
Digitalmars-d-learn wrote:
On Friday, 17 March 2017 at 17:13:48 UTC, Russel Winder wrote:
> I have a bit of code:
>
> string[] returnValue;
>foreach(string key, string[] value; grou
On Saturday, 4 March 2017 at 17:11:46 UTC, Andrey wrote:
Hello, is there any way to using in expression like in python,
e.g.
if 4 in [1, 3, 4]:
do something
My code in D
if (regionAlign in [RegionAlign.top, RegionAlign.bottom]) {
...
}
throws an error:
incompatible types for (((cast(
On Friday, 24 February 2017 at 14:06:22 UTC, Meta wrote:
On Friday, 24 February 2017 at 11:17:46 UTC, John Colvin wrote:
Unfortunately that only works by accident of my example. A
counterexample:
T foo(Q = float, T = short)(T t) { return t; }
alias Typeof(alias v) = typeof(v);
template getIn
On Thursday, 23 February 2017 at 18:33:33 UTC, Meta wrote:
On Thursday, 23 February 2017 at 18:21:51 UTC, Meta wrote:
On Thursday, 23 February 2017 at 16:01:44 UTC, John Colvin
wrote:
Is there any way to get a reference/alias to the
instantiation of a template function that would be called,
gi
Is there any way to get a reference/alias to the instantiation of
a template function that would be called, given certain
parameters? I.e. to get the result of whatever template parameter
inference (and overload resolution) has occurred?
E.g. for some arbitrarily complex foo:
static assert(__
On Tuesday, 14 February 2017 at 11:34:22 UTC, Bastiaan Veelo
wrote:
On Monday, 13 February 2017 at 22:59:11 UTC, John Colvin wrote:
Why not use a constructor instead of static opCall?
I don't know, this comes from
http://dlang.org/spec/struct.html#dynamic_struct_init. Your
constructor looks
On Tuesday, 14 February 2017 at 10:49:19 UTC, Bastiaan Veelo
wrote:
On Tuesday, 14 February 2017 at 01:31:10 UTC, John Colvin wrote:
On Monday, 13 February 2017 at 22:59:11 UTC, John Colvin wrote:
[ snip ]
sorry, made a typo, that should have been
alias int1 = Initial!(int, 1);
stat
On Monday, 13 February 2017 at 22:59:11 UTC, John Colvin wrote:
[ snip ]
sorry, made a typo, that should have been
alias int1 = Initial!(int, 1);
static assert(int1.initial == 1); // typeof(int1.initial)
== int
static assert(int1.init == 1); // typeof(int1.init) == int1
On Monday, 13 February 2017 at 22:16:36 UTC, Bastiaan Veelo wrote:
On Monday, 13 February 2017 at 16:40:02 UTC, Daniel Kozak wrote:
https://dlang.org/phobos/std_typecons.html#.Typedef
Thanks for the pointers. Both Typedef and Proxy create types
that don't mix with the base type, which I want
On Tuesday, 31 January 2017 at 14:15:58 UTC, Ivan Kazmenko wrote:
Hi.
I wanted to check whether a few variables of the same type are
all distinct, in a quick and dirty way. I tried to do it
similar to Python's "len(set(value_list)) == len(value_list)"
idiom by using an associative array (AA)
On Thursday, 19 January 2017 at 07:48:03 UTC, Jot wrote:
alias a = myarray[k];
fails
myarray is a multidimensial array that I want to reduce writing
it every time but D complains that it can't alias it.
I simply want it to do a direct substitution, nothing fancy,
just to reducing typing.
On Saturday, 26 November 2016 at 17:37:57 UTC, Paolo Invernizzi
wrote:
This is stated in documentation [1]:
immutable long[string] aa = [
"foo": 5,
"bar": 10,
"baz": 2000
];
unittest
{
assert(aa["foo"] == 5);
assert(aa["bar"] == 10);
assert(aa["baz"] == 2000);
}
But results t
On Thursday, 24 November 2016 at 09:52:32 UTC, Jot wrote:
Using vibe D. designed to update dmd to latest and then I now
get the following errors:
.dub\obj\debug\dev\source\app.obj(app)
Error 42: Symbol Undefined
_D3std6format12arrayPtrDiffFNaNbNiNexAvxAvZi
.dub\obj\debug\dev\source\app.obj(a
On Saturday, 19 November 2016 at 19:36:50 UTC, Marduk wrote:
On Saturday, 19 November 2016 at 17:37:58 UTC, John Colvin
wrote:
On Saturday, 19 November 2016 at 10:20:16 UTC, Marduk wrote:
Additionally, I would like to assign 2D sub-arrays of a 3D
array, i.e. something like the following:
int[
On Saturday, 19 November 2016 at 10:20:16 UTC, Marduk wrote:
Additionally, I would like to assign 2D sub-arrays of a 3D
array, i.e. something like the following:
int[3][2][2] a;
a[0] = [[2,2], [2,2]];
You have the dimensions the wrong way around. a is a 2 element
array of 2 element arrays o
On Sunday, 30 October 2016 at 23:57:11 UTC, Ali Çehreli wrote:
While working on a solution for Alfred Newman's thread, I came
up with the following interim solution, which compiled but
failed:
auto parse(R, S)(R range, S separators) {
import std.algorithm : splitter, filter, canFind;
i
On Saturday, 17 September 2016 at 12:09:04 UTC, Edwin van Leeuwen
wrote:
On Saturday, 17 September 2016 at 11:57:17 UTC, John Colvin
wrote:
On Saturday, 17 September 2016 at 11:45:07 UTC, Edwin van
Leeuwen wrote:
But I assumed he meant adding the formula onto the plot.
Hah, yes, I should have
On Saturday, 17 September 2016 at 11:45:07 UTC, Edwin van Leeuwen
wrote:
On Saturday, 17 September 2016 at 11:22:04 UTC, John Colvin
wrote:
On Saturday, 17 September 2016 at 02:41:15 UTC, brocolis wrote:
How do I draw math formulas programmatically? I want to do on
screen what latex does on .pd
On Saturday, 17 September 2016 at 02:41:15 UTC, brocolis wrote:
How do I draw math formulas programmatically? I want to do on
screen what latex does on .pdf.
And I want to draw a math formula in the image generated with
ggplotd.
Generate data from those formulas (I like to do this with
some
On Wednesday, 18 May 2016 at 12:24:06 UTC, TheDGuy wrote:
On Wednesday, 18 May 2016 at 03:15:25 UTC, Mike Parker wrote:
That should get your library.
Thanks for your answer. I tried that on my windows console and
i got the error that the command 'dub' can't be found.
http://code.dlang.org/d
On Thursday, 12 May 2016 at 00:04:43 UTC, Adam D. Ruppe wrote:
On Wednesday, 11 May 2016 at 23:46:48 UTC, John Colvin wrote:
Bug? Or am I misunderstanding how these two features are
supposed to interact?
I'm not sure what you actually expected there, but I'd note
that in general, opDispatch w
struct S
{
int a;
template opDispatch(string s)
{
template opDispatch(T...)
{
auto ref opDispatch(Args ...)(auto ref Args args)
{
return S(mixin(`a.` ~ s ~ (T.length ? `!T` : ``)
~ `(args)`));
}
}
}
}
in
On Monday, 9 May 2016 at 20:14:25 UTC, deed wrote:
struct Foo {
Bars bars;
...
}
struct Foos {
Foo[] arr;
Foo opIndex (size_t idx) { return arr[idx]; }
...
}
struct Bar {
// No Car[] cars;
...
}
struct Bars {
Bar[] arr;
Bar opIndex (size_t idx) { return arr[
On Monday, 4 April 2016 at 02:32:56 UTC, Yuxuan Shui wrote:
On Monday, 4 April 2016 at 00:50:27 UTC, Jonathan M Davis wrote:
On Sunday, April 03, 2016 23:46:10 John Colvin via
Digitalmars-d-learn wrote:
On Saturday, 2 April 2016 at 16:00:51 UTC, Jonathan M Davis
wrote:
> [...]
Ma
On Saturday, 2 April 2016 at 16:00:51 UTC, Jonathan M Davis wrote:
On Saturday, April 02, 2016 15:38:30 Ozan via
Digitalmars-d-learn wrote:
On Friday, 1 April 2016 at 20:50:32 UTC, Yuxuan Shui wrote:
> Why?
>
> This is annoying when I need to feed it into a function that
> requires hasLength.
On Sunday, 13 March 2016 at 13:02:16 UTC, Bastien wrote:
Hi, apologies for what may be a fairly obvious question to some.
## The background:
I have been tasked with building software to process data
output by scientific instruments for non-experts - basically
with GUI, menus, easy config files
On Wednesday, 9 March 2016 at 10:48:30 UTC, cym13 wrote:
On Wednesday, 9 March 2016 at 10:28:06 UTC, John Colvin wrote:
Potential for leaking references from alias this aside, is
there some reason that I shouldn't do this for all my C++-like
RAII needs:
class A
{
~this(){ import std.s
Potential for leaking references from alias this aside, is there
some reason that I shouldn't do this for all my C++-like RAII
needs:
class A
{
~this(){ import std.stdio; writeln("hello"); }
}
auto RAII(T)()
if (is(T == class))
{
struct Inner
{
private u
On Friday, 26 February 2016 at 17:15:02 UTC, Wyatt wrote:
On Thursday, 25 February 2016 at 22:28:52 UTC, jmh530 wrote:
I think PyD is really your best option.
That's what I figured, but I wanted to be sure because, well...
http://pyd.readthedocs.org/en/latest/embed.html
...these are some s
On Thursday, 18 February 2016 at 23:28:43 UTC, Joel wrote:
On Thursday, 18 February 2016 at 16:33:51 UTC, John Colvin
wrote:
[...]
I don't think I put 'sudo brew' at any point (I can't
remember). I hope I haven't broken my OSX!
[...]
Did you recently upgrade OS X? Anyway, you should proba
On Thursday, 18 February 2016 at 07:52:11 UTC, Joel wrote:
On Thursday, 18 February 2016 at 07:11:23 UTC, Joel wrote:
I had dub installed in a folder that meant I had to put 'sudo
dub' to run it. I've tried to fix the problem, but where do
you put it (also I tried one place, but couldn't put it
On Thursday, 11 February 2016 at 13:05:41 UTC, Claude wrote:
Hello,
I come from the C world and try to do some procedural terrain
generation, and I thought ndslice would help me to make things
look clean, but I'm very new to those semantics and I need help.
Here's my problem: I have a C-styl
On Wednesday, 6 January 2016 at 13:36:03 UTC, data pulverizer
wrote:
I have been converting C numeric libraries and depositing them
here: https://github.com/dataPulverizer. So far I have glpk and
nlopt converted on a like for like c function basics. I am now
stuck on the gsl library, primarily
On Saturday, 2 January 2016 at 14:57:58 UTC, Shriramana Sharma
wrote:
John Colvin wrote:
Strictly speaking you aren't calling a constructor there,
you're writing a struct literal.
Why do you say I'm not calling a constructor?
https://dlang.org/spec/struct.html#struct-literal
And that still
On Saturday, 2 January 2016 at 12:08:48 UTC, Meta wrote:
On Saturday, 2 January 2016 at 12:07:31 UTC, John Colvin wrote:
You are manually breaking immutable by making a union of
immutable and mutable data and then writing to the mutable
reference. This is roughly equivalent to casting away
imm
On Saturday, 2 January 2016 at 02:12:19 UTC, Shriramana Sharma
wrote:
If I have:
struct TimeSpan { double start, end; }
Then both the following automatically work:
auto s = TimeSpan();
auto t = TimeSpan(1, 2);
But if I make it a class (I need to) then I have to explicitly
define a field-wise
On Saturday, 2 January 2016 at 10:04:47 UTC, Shriramana Sharma
wrote:
import std.stdio;
union EarthLocation
{
struct { immutable double lon, lat, alt; }
double[3] data;
}
void main()
{
EarthLocation d = {data: [4, 5, 6]};
writeln(d.data);
d.data = [1, 2, 3];
writeln(d.data
On Wednesday, 16 December 2015 at 10:15:49 UTC, Saurabh Das wrote:
On Wednesday, 16 December 2015 at 10:07:38 UTC, Saurabh Das
wrote:
On Wednesday, 16 December 2015 at 09:38:24 UTC, Ali Çehreli
wrote:
On 12/16/2015 01:26 AM, Saurabh Das wrote:
struct xlref
{
ushort rwFirst;
ushort rw
On Wednesday, 16 December 2015 at 09:26:33 UTC, Saurabh Das wrote:
struct xlref
{
ushort rwFirst;
ushort rwLast;
ubyte colFirst;
ubyte colLast;
}
struct xlmref
{
ushort count;
xlref reflist;
}
Mac OS X (dmd 2.069.0)
===
dmd dprob.d
Segmentation fault: 11
On Wednesday, 16 December 2015 at 07:46:53 UTC, Jacob Carlborg
wrote:
On 2015-12-15 15:43, John Colvin wrote:
I have no idea how you got something in /Library/D, but it
doubt it
was from homebrew.
The native installer installs into /Library/D.
Well that probably explains the problem then.
On Tuesday, 15 December 2015 at 09:04:45 UTC, Jacob Carlborg
wrote:
On 2015-12-15 09:08, Mike McKee wrote:
On Tuesday, 15 December 2015 at 07:52:50 UTC, Jacob Carlborg
wrote:
Could you please add "-v" do the command line when compiling.
Mine was completely different:
$ dmd -v test.d
binary
On Monday, 14 December 2015 at 11:12:03 UTC, Ali Çehreli wrote:
On 12/14/2015 02:09 AM, Mike McKee wrote:
I finally managed to get it working
Congratulations! But this is not the right medium for this blog
post. ;) Please polish and publish it somewhere before someone
puts it on Reddit now.
On Saturday, 5 December 2015 at 09:49:06 UTC, ref2401 wrote:
I want to create a static array large enough to store 1MB of
float values.
What am I doing wrong?
Here is a sample code with notes:
void main(string[] args) {
enum size_t COUNT = 1024 * 512 / float.sizeof; // works OK :)
//en
On Wednesday, 25 November 2015 at 16:11:09 UTC, Ozan wrote:
Hi
Is there any overview, list, wiki about what's behind runtime
errors like
"Program exited with code -11"?
Okay, I made a mistake...but it's better to know where and what
kind?
Thanks & Regards,
Ozan
That's just normal exit-co
On Wednesday, 25 November 2015 at 08:10:03 UTC, Jack Applegame
wrote:
This doesn't compile:
import std.range;
import std.algorithm;
void main() {
char[64] arr;
copy(chain("test1", "test2"), arr[0..10]);
}
http://dpaste.dzfl.pl/24230ac02e6e
Essentially this comes down to the q
On Thursday, 19 November 2015 at 06:33:06 UTC, Jay Norwood wrote:
On Wednesday, 18 November 2015 at 22:46:01 UTC, jmh530 wrote:
My sense is that any data frame implementation should try to
build on the work that's being done with n-dimensional slices.
I've been watching that development, but I
On Thursday, 19 November 2015 at 06:20:28 UTC, Andrew wrote:
The documentation gives plenty of examples of how to use a
static if with the arity trait, but how do I specify the
constructor of an object as the parameter to arity?
Thanks
Ugly but works:
import std.traits;
struct A
{
On Wednesday, 18 November 2015 at 14:11:45 UTC, maik klein wrote:
On Wednesday, 18 November 2015 at 13:51:59 UTC, John Colvin
wrote:
On Wednesday, 18 November 2015 at 12:20:42 UTC, maik klein
wrote:
[...]
I think this is a bug, please report it at issues.dlang.org
and perhaps there will be a
On Wednesday, 18 November 2015 at 12:20:42 UTC, maik klein wrote:
https://stackoverflow.com/questions/33779822/unable-to-call-each-on-a-lockstep-range-containing-2-or-more-ranges
http://dpaste.dzfl.pl/76c79f1f12ab
void main(){
import std.container;
import std.stdio;
import std.algorithm.i
On Thursday, 12 November 2015 at 15:06:26 UTC, ric maicle wrote:
On Thursday, 12 November, 2015 07:50 PM, anonymous wrote:
__traits has special syntax. The first "argument" must be from
a list of
special keywords that only have special meaning in that place.
You can't
put the name of a struct t
On Monday, 2 November 2015 at 09:16:09 UTC, Nordlöw wrote:
On Monday, 2 November 2015 at 09:02:28 UTC, Gary Willoughby
wrote:
On Monday, 2 November 2015 at 08:23:16 UTC, Nordlöw wrote:
I need `T` to be an alias in order for .stringof to work.
typeof(T).stringof
No, I want the variable name
On Saturday, 24 October 2015 at 13:18:26 UTC, Shriramana Sharma
wrote:
Hello. I had first expected that dynamic arrays (slices) would
provide a `.clear()` method but they don't seem to. Obviously I
can always effectively clear an array by assigning an empty
array to it, but this has unwanted co
On Friday, 23 October 2015 at 12:22:49 UTC, tcak wrote:
[code]
mixin template Test(alias a){
int a;
}
void main(){
mixin Test!blah;
}
[/code]
Compiler says it doesn't know about "blah". My purpose is to
define the parameter as a variable. Is that possible?
you would have to us
On Thursday, 22 October 2015 at 18:20:07 UTC, pineapple wrote:
I'd like to use fread and fwrite in place of File.rawRead and
File.rawWrite which force the creation of an array where I'd
rather specify a buffer location and length.
D's arrays *are* just buffer locations and lengths with a few
On Thursday, 22 October 2015 at 16:15:23 UTC, Shriramana Sharma
wrote:
I wanted a D equivalent to:
http://doc.qt.io/qt-5/qdatastream.html
https://docs.python.org/3/library/pickle.html
and saw that one is under construction:
http://wiki.dlang.org/Review/std.serialization
But till it's finali
On Thursday, 22 October 2015 at 15:10:58 UTC, pineapple wrote:
On Thursday, 22 October 2015 at 14:36:52 UTC, John Colvin wrote:
Using ranges instead of threads or fibers, slightly
over-engineered to show off features:
What does if(isIntegral!T) do? It looks like it would verify
that the templ
On Thursday, 22 October 2015 at 13:53:33 UTC, pineapple wrote:
I'm just starting to hammer D's very pleasant syntax into my
head. After "Hello world", the first thing I do when learning
any language is to write a simple program which generates and
outputs the Collatz sequence for an arbitrary n
On Wednesday, 21 October 2015 at 12:05:27 UTC, Shriramana Sharma
wrote:
import std.math;
real round(real val, int prec)
{
real pow = 10 ^^ prec;
return round(val * pow) / pow;
}
Trying to compile this I get:
foo.d(5): Error: function foo.round (real val, int prec) is not
callable using
On Tuesday, 20 October 2015 at 16:01:58 UTC, Andrea Fontana wrote:
On Tuesday, 20 October 2015 at 15:55:47 UTC, John Colvin wrote:
Be aware that there will be one instance of val per thread, so
you are detecting the first run in each thread, not in the
program overall.
This is the kind of thi
On Tuesday, 20 October 2015 at 15:48:47 UTC, Andrea Fontana wrote:
It happens I need to perform an operation just one time (inside
a function, a loop...)
I wonder if doing this it's a good idea or not.
bool isFirstTime(alias T)()
{
static val = true;
if (val)
{
On Friday, 16 October 2015 at 15:48:59 UTC, Edwin van Leeuwen
wrote:
Just wondering if anyone has any tips on how to solve/avoid
"cannot deduce function from argument types" when relying on
template programming.
I run into these problems all the time. Current one was when I
tried:
```
auto
On Friday, 16 October 2015 at 15:48:59 UTC, Edwin van Leeuwen
wrote:
Just wondering if anyone has any tips on how to solve/avoid
"cannot deduce function from argument types" when relying on
template programming.
I run into these problems all the time. Current one was when I
tried:
```
auto
On Friday, 16 October 2015 at 12:03:56 UTC, Per Nordlöw wrote:
On Friday, 16 October 2015 at 11:48:19 UTC, Edwin van Leeuwen
wrote:
zip(r, r[1..$]).map!((t) => t[1]-t[0]);
And for InputRanges (not requiring random-access):
zip(r, r.dropOne).map!((t) => t[1]-t[0]);
We should have a good impl
On Friday, 16 October 2015 at 11:11:28 UTC, Guillaume Chatelet
wrote:
Is there an idiomatic way to do:
int[] numbers = [0, 1, 2, 3];
assert(adjacent_diff(numbers) == [1, 1, 1]);
I can't find something useful in the std library.
import std.range, std.algorithm;
auto slidingWindow(R)(R r, size
On Thursday, 15 October 2015 at 15:45:00 UTC, Shriramana Sharma
wrote:
John Colvin wrote:
On Wednesday, 14 October 2015 at 15:02:02 UTC, Shriramana
Sharma
wrote:
What binary arithmetic operators do you need that real[]
doesn't
already support?
OMG silly me! I can already do a[] /= b[]... D
On Wednesday, 14 October 2015 at 15:25:22 UTC, David DeWitt wrote:
On Wednesday, 14 October 2015 at 14:48:22 UTC, John Colvin
wrote:
On Wednesday, 14 October 2015 at 14:32:00 UTC, jmh530 wrote:
On Tuesday, 13 October 2015 at 23:26:14 UTC, Laeeth Isharc
wrote:
https://www.quora.com/Why-is-Pytho
On Wednesday, 14 October 2015 at 15:02:02 UTC, Shriramana Sharma
wrote:
Hello. I just came upon a need in my program to make binary
arithmetic operators valid between two real[] in my programs
What binary arithmetic operators do you need that real[] doesn't
already support?
On Wednesday, 14 October 2015 at 14:32:00 UTC, jmh530 wrote:
On Tuesday, 13 October 2015 at 23:26:14 UTC, Laeeth Isharc
wrote:
https://www.quora.com/Why-is-Python-so-popular-despite-being-so-slow
Andrei suggested posting more widely.
I was just writing some R code yesterday after playing aroun
On Tuesday, 13 October 2015 at 13:21:54 UTC, Suliman wrote:
I tried to use map! but it's look like it do not work with
string, becouse I got error: Error: no property 'map' for type
'ByLine!(char, char)'
I suspect you don't have it imported.
import std.algorithm;
or
import std.algorithm : m
On Thursday, 8 October 2015 at 21:40:02 UTC, TheGag96 wrote:
In my code I'm passing an array of BitArrays to a constructor
like this (though mostly as a placeholder):
Terrain t = new Terrain(1, 15, [
BitArray([1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]),
BitArray([1, 1, 1, 1, 1, 0, 1, 1,
On Thursday, 8 October 2015 at 15:22:02 UTC, tcak wrote:
BTW, there is nothing like std.traits.hasLength.
yeah, that's because __traits(hasMember, ...) should be good
enough, but obviously not in this case at the moment.
On Thursday, 8 October 2015 at 09:29:30 UTC, tcak wrote:
I am "trying" to write a function that takes an array of items,
and returns the length of longest item.
[code]
size_t maxLength(A)( const A[] listOfString ) if( __traits(
hasMember, A, "length" ) )
{
return 0; // not implemented
On Monday, 5 October 2015 at 09:53:09 UTC, Per Nordlöw wrote:
On Monday, 5 October 2015 at 08:45:54 UTC, John Colvin wrote:
http://dlang.org/phobos/index.html it's on the sidebar
I can't find allocator there (yet) in tree.
http://dlang.org/phobos-prerelease/std_experimental_allocator.html
Wh
On Monday, 5 October 2015 at 08:19:26 UTC, Per Nordlöw wrote:
Is there an (official or unoffical) prerelease version of the
Phobos docs, typically for studying std.allocator?
It would be nice to have the D servers auto-generate this every
time a PR is merged into druntime/phobos.
http://dlan
On Sunday, 4 October 2015 at 20:26:51 UTC, John Colvin wrote:
template bish(T)
{
alias tmp = bish0!T;
alias tmp = bish1!T;
alias bish = tmp;
}
https://issues.dlang.org/show_bug.cgi?id=15156
On Sunday, 4 October 2015 at 19:12:51 UTC, Laeeth Isharc wrote:
On Sunday, 4 October 2015 at 18:24:08 UTC, John Colvin wrote:
On Sunday, 4 October 2015 at 18:08:55 UTC, Laeeth Isharc wrote:
On Sunday, 4 October 2015 at 17:17:14 UTC, Laeeth Isharc
wrote:
On Sunday, 4 October 2015 at 16:37:34 UT
On Sunday, 4 October 2015 at 18:08:55 UTC, Laeeth Isharc wrote:
On Sunday, 4 October 2015 at 17:17:14 UTC, Laeeth Isharc wrote:
On Sunday, 4 October 2015 at 16:37:34 UTC, John Colvin wrote:
On Sunday, 4 October 2015 at 15:45:55 UTC, Laeeth Isharc
wrote:
How do I persuade partial to tie itself t
On Sunday, 4 October 2015 at 15:45:55 UTC, Laeeth Isharc wrote:
How do I persuade partial to tie itself to the appropriate
overload?
I have:
alias
bars=partial!(slurpBars!BarType,filename,startDate,endDate);
where there are two overloads of slurpBars:
SomeBar[] slurpBars(SomeBar)(string fil
1 - 100 of 512 matches
Mail list logo