I would like to write a function which takes an array as input,
and returns a sorted array without duplicates.
In fact, i have a function which does this, but i think it may
have some extra unnecessary steps.
```d
private S[] _sort_array( S )( S[] x ) {
import std.algorithm;
a
On Sunday, 22 January 2023 at 07:33:01 UTC, evilrat wrote:
On Sunday, 22 January 2023 at 04:42:09 UTC, dan wrote:
I would like to write a function which takes an array as
input, and returns a sorted array without duplicates.
```d
private S[] _sort_array( S )( S[] x ) {
import std.al
Hi,
I'm parsing some files, each containing (among other things) 10
bytes said to represent an IEEE 754 extended floating point
number, in SANE (Standard Apple Numerical Environment) form, as
SANE existed in the early 1990s (so, big endian).
Note that the number actually stored will probably
On Wednesday, 23 August 2023 at 03:24:49 UTC, z wrote:
On Tuesday, 22 August 2023 at 22:38:23 UTC, dan wrote:
Hi,
I'm parsing some files, each containing (among other things)
10 bytes said to represent an IEEE 754 extended floating point
number, in SANE (Standard Apple Numerical Environment)
I have some code that i would like executed before anything else
is.
The code is to set an environment variable which is used by a
library. I'm trying to find some way to avoid setting the
environment variable on the command line, or in any shell script
or initialization file.
I think the
On Monday, 16 October 2023 at 03:33:55 UTC, Richard (Rikki)
Andrew Cattermole wrote:
On 16/10/2023 4:31 PM, dan wrote:
I suppose if i could figure out a way to make all other
modules depend on my module this would happen, but the module
which uses the variable i want to set is in some
already-
On Monday, 16 October 2023 at 04:26:32 UTC, Paul Backus wrote:
On Monday, 16 October 2023 at 03:31:13 UTC, dan wrote:
I have some code that i would like executed before anything
else is.
The code is to set an environment variable which is used by a
library. I'm trying to find some way to avo
On Monday, 16 October 2023 at 10:23:54 UTC, Richard (Rikki)
Andrew Cattermole wrote:
Okay, after looking at gtkd, I don't think this can be solved
with module constructors or swapping out to lazy initialization.
One way that might work however is to use a crt_constructor as
that runs before th
On Monday, 16 October 2023 at 18:57:45 UTC, bachmeier wrote:
On Monday, 16 October 2023 at 18:28:52 UTC, dan wrote:
(Now, i still think that when module initialization order is
not forced, it should be something a programmer or systems
integrator can choose, but i don't want to be too greedy.)
I have a double precision number that i would like to print all
significant digits of, but no more than what are actually present
in the number. Or more exactly, i want to print the minimum
number of digits necessary to recover the original number to
within 2 or 3 least significant bits in the
On Wednesday, 9 October 2019 at 10:54:49 UTC, David Briant wrote:
On Tuesday, 8 October 2019 at 20:37:03 UTC, dan wrote:
I have a double precision number that i would like to print
all significant digits of, but no more than what are actually
present in the number. Or more exactly, i want to p
On Thursday, 10 October 2019 at 22:44:05 UTC, H. S. Teoh wrote:
On Thu, Oct 10, 2019 at 09:13:05PM +, Jon Degenhardt via
Digitalmars-d-learn wrote:
On Thursday, 10 October 2019 at 17:12:25 UTC, dan wrote:
> Thanks also berni44 for the information about the dig
> attribute, Jon
> for the nea
I'm looking for a function something like writeln or write, but
instead of writing to stdout, it writes to a string and returns
the string.
So i would like something like:
import std.stdio;
import std.conv;
string write_to_string(T...)(T values ) {
string s;
foreach ( value; values ) s ~=
On Saturday, 2 May 2020 at 02:29:43 UTC, H. S. Teoh wrote:
On Sat, May 02, 2020 at 02:22:42AM +, dan via
Digitalmars-d-learn wrote:
I'm looking for a function something like writeln or write,
but instead of writing to stdout, it writes to a string and
returns the s
On Saturday, 2 May 2020 at 02:49:04 UTC, Steven Schveighoffer
wrote:
On 5/1/20 10:40 PM, dan wrote:
On Saturday, 2 May 2020 at 02:29:43 UTC, H. S. Teoh wrote:
On Sat, May 02, 2020 at 02:22:42AM +, dan via
Digitalmars-d-learn wrote:
[...]
[...]
import std.format : format;
string
On Saturday, 2 May 2020 at 10:36:47 UTC, Ali Çehreli wrote:
On 5/1/20 7:40 PM, dan wrote:> On Saturday, 2 May 2020 at
02:29:43 UTC, H. S. Teoh wrote:
>> On Sat, May 02, 2020 at 02:22:42AM +0000, dan via
Digitalmars-d-learn
>> wrote:
>>> I'm looking for a function so
Debian 10 has a nice gtkd package, stored in libgtkd-3-dev i
believe (when i installed it, i installed several packages at
once, basically everything that had 'gtkd' as a substring in the
package name).
It uses ldmd2 (part of the ldc package).
So it's possible to write and build a gtkd applic
Are there any d compilers that run natively on the Mac Mini with
an M1 chip?
If so, does anybody here have any experience with them that can
be shared?
If not, and your machine is a mac mini, how would you go about
programming in d on it?
TIA for any info!
On Friday, 26 March 2021 at 21:54:20 UTC, rikki cattermole wrote:
On 27/03/2021 10:51 AM, dan wrote:
Are there any d compilers that run natively on the Mac Mini
with an M1 chip?
If so, does anybody here have any experience with them that
can be shared?
If not, and your machine is a mac mini
I was writing some code and added a line like
x.write;
expecting to fill it in later.
I forgot to actually write a function write, but it compiled
anyway, and some testing shows that if you write
auto o = new Object;
o.write;
then this compiles just fine. (The 'write' method,
On Tuesday, 7 November 2017 at 21:32:26 UTC, Adam D. Ruppe wrote:
On Tuesday, 7 November 2017 at 21:25:00 UTC, dan wrote:
I looked in my distribution's object.d (debian stretch, gdc, in
Did you import std.stdio in the file?
If so, it is calling the std.stdio.write on the object (this is
call
I am a very new c++ programmer, having just learned the language
this year.
A few months ago I completed a course on Coursera that dealt with
the security aspect of c (which I don't know, but it is similar
enough):
https://class.coursera.org/softwaresec-008
The course highlighted just how d
Thanks everyone for taking the time to respond!
@Lobo,
Start using D now. It's not all or nothing so you don't have to
give up on C++. I have several projects that contain both C++
and D intermixed.
Using both does seem like a good way to transition. I could
combine the strengths of D with
Is it possible to have a class which has a variable which can be
seen from the outside, but which can only be modified from the
inside?
Something like:
class C {
int my_var = 3; // semi_const??
void do_something() { my_var = 4; }
}
And then in another file
auto c = new C();
c.my_var
Thanks Vit, Meta, and Yuxuan for your speedy help!
So 3 pieces to put together, function, const, and @property (and
i guess final for protection against subclasses).
On Monday, 23 May 2016 at 07:03:08 UTC, chmike wrote:
On Saturday, 21 May 2016 at 17:32:47 UTC, dan wrote:
(This effect could be simulated by making my_var into a
function, but i don't want to do that.)
May I ask why you don't want to do that ?
In D you can call a function without args witho
Is there a standard alias for a class name inside class code?
Something like 'this' referring to a class instance, but
referring instead to the class itself?
What i would like to do is have something like
class Clas {
// alias Clas THIS; <- don't want this boilerplate
static THIS make_i
On Sunday, 29 May 2016 at 00:28:13 UTC, Mithun Hunsur wrote:
On Sunday, 29 May 2016 at 00:14:17 UTC, dan wrote:
Is there a standard alias for a class name inside class code?
Something like 'this' referring to a class instance, but
referring instead to the class itself?
[...]
typeof(this) g
On Sunday, 29 May 2016 at 02:44:33 UTC, jhps wrote:
On Sunday, 29 May 2016 at 00:48:20 UTC, dan wrote:
Especially in a declaration like
static typeof(this) make_instance( )
but also in the 'new typeof(this)'. In both cases, 'this'
doesn't even exist.
https://dlang.org/spec/declaration.h
I'm writing a small program (compiled with gdc on xubuntu 16.04).
I would like it to remember a little data (a few kilobytes maybe).
It looks like d comes with standard support for both sqlite3 and
json --- is there any particular reason to prefer one over the
other? Or maybe something else
On Thursday, 14 July 2016 at 08:28:56 UTC, Jacob Carlborg wrote:
On 2016-07-14 07:18, dan wrote:
I'm writing a small program (compiled with gdc on xubuntu
16.04).
I would like it to remember a little data (a few kilobytes
maybe).
.
My main concern is minimizing program complexity.
Awesome!!
Thanks Gary and namespace (and obviously i gotta improve my
google-fu).
dan
On Sunday, 17 May 2015 at 19:40:10 UTC, Gary Willoughby wrote:
On Sunday, 17 May 2015 at 18:58:32 UTC, Namespace wrote:
http://dlang.org/operatoroverloading.html#function-call
Like this:
module main;
i
Is it possible to define a class F so that
auto f=new F();
writeln("The value of f at 7 is ",f(7));
compiles and works as expected?
So the idea would be to be able to use notation like
f(7)
instead of
f.eval(7)
or something along those lines.
My guess is no, it is impossible to d
hi
I'm using those imports:
import core.runtime;
import core.sys.windows.windows;
when I call GetWindowTextW DMD compiler complains!
(error:undefined identifier)
any solution?
I'm new to Dlang and I have no Idea whats wrong with this code!
wchar[260] buffer;
HWND hWindow = GetForegroundWindow();
GetWindowTextW(hWindow, buffer, sizeof(title)); <-- Problem here
GetWindowTextW(hWindow, buffer, sizeof(title)); <-- Problem here
please Ignore the sizeof(title) parameter, I copied that from c++
equivalent code :D
thank you John it worked :)
do I always need do the same for all windows API?
thank you so much John :)
In c, there's this very nice function strncmp(s1,s2,count) which
compares two c strings, using at most count characters. count
can be less than, more than, or equal to either or both of the
lengths of the two strings. It can be used to see if two
c-strings have the same prefix of some length.
On Monday, 22 August 2016 at 01:45:02 UTC, Jonathan M Davis wrote:
On Monday, August 22, 2016 00:14:31 Adam D. Ruppe via
Digitalmars-d-learn wrote:
int strncmp(string a, string b, int n) {
if(a.length > n)
a = a[0 .. n];
if(b.length > n)
b = b[0 .. n];
import std.algorithm.comp
Are there any FOSS tools for doing dependency analysis of (e.g.)
all the d files in a directory, to let you know when a .o file
needs to be regenerated?
This presumably would depend mostly on the import statements
(including import of any file to be used in string construction,
as in 'auto my
On Monday, 5 September 2016 at 18:49:25 UTC, Basile B. wrote:
On Monday, 5 September 2016 at 18:22:08 UTC, ag0aep6g wrote:
On 09/04/2016 12:07 AM, dan wrote:
Are there any FOSS tools for doing dependency analysis of
[...]
[...]
I'm not aware of a standalone tool that does something like
this.
In c, you can have code like this:
static void wtest( void ) {
int f;
while ( ( f = some_val( ) ) ) {
printf(" our value is now: %d\n", f );
}
}
gcc compiles this without warning or error (at least if you use
the double parentheses to assure the compiler that you realize
you are test
On Saturday, 3 December 2016 at 09:03:25 UTC, rikki cattermole
wrote:
On 03/12/2016 9:55 PM, dan wrote:
[...]
If you can use another compiler do so, gdc is on an old
frontend/Phobos now. I recommend ldc or you know the reference
compiler dmd if performance/platform isn't an issue (not that
44 matches
Mail list logo