Hi.
I'm looking at the compiler output of DMD (-O -release), LDC (-O
-release), and GDC (-O3) for a simple array operation:
```
void add1 (int [] a)
{
foreach (i; 0..a.length)
a[i] += 1;
}
```
Here are the outputs: https://godbolt.org/z/GcznbjEaf
From what I gather at the view li
On Monday, 1 August 2022 at 20:36:12 UTC, pascal111 wrote:
My complaint is about that a function is not a same as an
expression that functions return values, but expressions being
evaluated to provide values.
An analogy.
With a ternary expression, we write:
`x = (cond ? a : b);`
The tradition
On Tuesday, 1 August 2023 at 23:57:29 UTC, Vahid wrote:
I want to submit a request to server with
"x-www-form-urlencoded" header.
Isn't https://dlang.org/library/std/net/curl/post.html what you
need?
On Monday, 12 February 2024 at 19:56:09 UTC, H. S. Teoh wrote:
But regardless, IMNSHO any programmer worth his wages ought to
learn what an unsigned type is and how it works. A person
should not be writing code if he can't even be bothered to
learn how the machine that's he's programming actual
On Sunday, 5 December 2021 at 16:37:21 UTC, Chris Katko wrote:
Yes! Thank you! I just realized the latter part was broken when
I switched to using a uint for the addr. But I didn't know
string is an alias for immutable(char)[]! Thank you!
Yeah, a `const(char)[]` argument is designed to accept
Hi,
How should I set up DMD to be able to `dmd -m64` on Windows
nowadays?
I usually download the 7z, but it broke when I replaced my Visual
Studio with 2017 edition.
Now, I tried the current 2.081.1 .exe installer. It didn't
propose any additional 64-bit related options. After the
insta
Well, I tried all your suggestions.
(Actually re-tried a few times.)
Thanks, Laurent and Kagamin!
On Friday, 10 August 2018 at 14:47:04 UTC, Laurent Tréguier wrote:
Did you have a look at the wiki ? It looks like the image shows
what needs to be installed:
https://wiki.dlang.org/Installing_DMD#
On Sunday, 12 August 2018 at 03:49:04 UTC, Mike Parker wrote:
On Saturday, 11 August 2018 at 19:50:30 UTC, Ivan Kazmenko
wrote:
I've installed the components shown in wiki image: v141 tools
and the SDKs.
VS 2017 Community includes everything you need. There's no
reason to install the SDK sepa
On Friday, 14 December 2018 at 15:38:49 UTC, Giovanni Di Maria
wrote:
Hi
Is there an utility to print
the functions in a source file, for example:
- main()
--- calculate()
- print()
--- simulate()
- print()
.
Thank you very much
Giovanni Di Maria
Do you really have a nested functio
On Sunday, 16 July 2017 at 10:37:39 UTC, kerdemdemir wrote:
My goal is to find connected components in a 2D array for
example finding connected '*'
chars below.
x x x x x x
x x x x x x
x x * * x x
x x * * x x
x x x * * x
* x x x x x
...
Is there any bett
On Sunday, 16 July 2017 at 21:50:19 UTC, kerdemdemir wrote:
Process(row-1,column-1, maxrow, maxcolumn);
Process(row,column-1, maxrow, maxcolumn);
Process(row+1,column-1, maxrow, maxcolumn);
Process(ro
On Monday, 17 July 2017 at 07:14:26 UTC, Andrea Fontana wrote:
Probably using ndslice library could help you!
Unfortunately, that's not possible on most online contest
platforms like Codeforces. For each programming language and
compiler available, only the most basic package is usually
in
On Tuesday, 18 July 2017 at 13:35:49 UTC, SrMordred wrote:
There is a way to get the full function(or any other structure)
declaration with traits? Or I will have to mount it with
std.traits functions?
eg.
void add(int x, int y){}
GetFullFunctionDeclaration!add; //return "void add(int x, int
On Wednesday, 30 August 2017 at 10:13:57 UTC, Timothy Foster
wrote:
I'm not sure if this is a known issue, or if I just don't
understand how to use threads, but I've got writeln statements
sometimes printing out twice in some areas of my code.
<...>
Does anyone know what is causing this or how
On Wednesday, 30 August 2017 at 10:55:20 UTC, Timothy Foster
wrote:
import std.stdio, core.thread;
void main(){
auto thread = new Thread(&func).start;
writeln("Output");
writeln("Output2");
writeln("Output3");
while(true){}
}
void func(){
foreach(
On Wednesday, 30 August 2017 at 13:24:55 UTC, Ivan Kazmenko wrote:
On Wednesday, 30 August 2017 at 10:55:20 UTC, Timothy Foster
wrote:
import std.stdio, core.thread;
void main(){
auto thread = new Thread(&func).start;
writeln("Output");
writeln("Output2");
wr
On Wednesday, 30 August 2017 at 13:33:06 UTC, Ivan Kazmenko wrote:
Interesting. As to what to do with it, no idea for now. At
the very least we can issue a bug report, now that at least two
people can reproduce it, so it is unlikely to be
environment-dependent.
Reported: https://issues.dlan
On Thursday, 31 August 2017 at 14:43:39 UTC, Steven Schveighoffer
wrote:
Just a thought, but the "double printing" could be a
misunderstanding. It could be printing Output\nOutput2, but not
getting the 2 out there.
No no, it's four lines instead of three. If we change the lines
to disjoint s
On Tuesday, 19 September 2017 at 20:47:02 UTC, greatsam4sure
wrote:
double value = 20.89766554373733;
writeln(value);
//Output =20.8977
How do I output the whole value without using writfln,write or
format. How do I change this default
The default when printing floating-point numbers is to s
On Tuesday, 19 September 2017 at 22:44:06 UTC, greatsam4sure
wrote:
On Tuesday, 19 September 2017 at 21:52:57 UTC, Ivan Kazmenko
wrote:
On Tuesday, 19 September 2017 at 20:47:02 UTC, greatsam4sure
wrote:
double value = 20.89766554373733;
writeln(value);
//Output =20.8977
How do I output the w
On Sunday, 22 October 2017 at 14:44:04 UTC, Timon Gehr wrote:
On 22.10.2017 16:20, Ilya Yaroshenko wrote:
.. i thought it should be (2 ^^ 1) ^^ 2 = 4
2 ^^ (1 ^^ 2) == 2
It is standard for ^/**/^^ to be right-associative. (This is
also the standard convention in mathematics.)
Yeah, and a he
On Thursday, 26 October 2017 at 10:02:54 UTC, Kagamin wrote:
On Sunday, 22 October 2017 at 22:28:48 UTC, Ivan Kazmenko wrote:
Yeah, and a height-3 tower $a^{b^c}$ (TEX notation)
Is $a^{b^c}$ the same as ${a^b}^c$ ? They are drawn slightly
differently, so I suppose it's ambiguous indeed.
Sur
Here's a simplified example of what I want to achieve.
I first create funs, an array of two delegates.
I want funs[0] to always return 0 and funs[1] to always return 1.
By assigning the constants directly (see the code below), I
achieve exactly that.
Now, I want to use a loop to assign the valu
On Thursday, 29 March 2018 at 15:38:14 UTC, ag0aep6g wrote:
<...> With immutable, this is certainly a problem.
https://issues.dlang.org/show_bug.cgi?id=2043
Wow, such history for the bug!
Two possible workarounds:
int delegate () [] iuns;
foreach (i; 0..2) iuns ~= (j) { return () =>
On Monday, 7 December 2015 at 22:03:42 UTC, Alex Parrill wrote:
On Monday, 7 December 2015 at 18:48:18 UTC, Random D user wrote:
struct Foo
{
this( int k )
{
a = k;
}
int a;
}
Foo foo;
int[ Foo ] map;
map[ foo ] = 1; // Crash! bug?
// This also crashes. I believe cras
On Tuesday, 8 December 2015 at 11:04:49 UTC, Random D user wrote:
On Tuesday, 8 December 2015 at 01:23:40 UTC, Ivan Kazmenko
wrote:
On Monday, 7 December 2015 at 22:03:42 UTC, Alex Parrill wrote:
On Monday, 7 December 2015 at 18:48:18 UTC, Random D user
Tested the same code with -m32 and -m64 o
On Tuesday, 8 December 2015 at 11:45:25 UTC, Random D user wrote:
Ok. This is minimal app that crashes for me. If someone could
try this:
OK, this at least reproducibly crashes here, too (-m32 and -m64
on Windows, tried dmd 2.069.0 and 2.067.1).
On Tuesday, 8 December 2015 at 11:45:25 UTC, Random D user wrote:
Ok. This is minimal app that crashes for me. If someone could
try this:
At the very least, there is no crash when changing `struct Foo`
to `static struct Foo`, so it is perhaps related to `Foo` being
an inner struct with a poin
On Tuesday, 8 December 2015 at 11:45:25 UTC, Random D user wrote:
Ok. This is minimal app that crashes for me. If someone could
try this:
Interesting.
With dmd 2.064.2, your example compiles and runs fine.
With dmd 2.065.0, it does not compile, complaining that there is
no opCmp for `Foo`s.
On Tuesday, 22 December 2015 at 18:11:24 UTC, rumbu wrote:
On Tuesday, 22 December 2015 at 17:15:27 UTC, Andrew Chapman
wrote:
Sorry if this is a silly question but is the to! method from
the conv library the most efficient way of converting an
integer value to a string?
e.g.
string s = to!st
On Tuesday, 22 December 2015 at 19:50:28 UTC, Daniel Kozák wrote:
V Tue, 22 Dec 2015 18:39:16 +
Ivan Kazmenko via Digitalmars-d-learn
napsáno:
Does DMD, or Phobos function to!(string), do anything like
that? The number of possible bases is not large anyway. I've
heard majo
On Saturday, 26 December 2015 at 01:04:57 UTC, Bubbasaur wrote:
It's almost like the example in the URL you showed:
dmd test.d -LC:/gtkd/src/build/GtkD.lib
Note that -L passes flags (options) but not necessarily arguments
or paths. For example, I use "dmd -L/STACK:268435456" by default
alon
On Sunday, 27 December 2015 at 20:01:47 UTC, Gary Willoughby
wrote:
On Sunday, 27 December 2015 at 17:23:35 UTC, Gary Willoughby
wrote:
I have a binary tree storing ints implemented using an array.
The internal state looks like this:
8,7,6,4,1,3,5,2
When extracting this data, it is returned a
On Sunday, 27 December 2015 at 22:36:32 UTC, Ali Çehreli wrote:
[Several hours later...]
You know what... I bet there is no actual allocation at all. I
think what happens is, the code calls GC.realloc(24) and
realloc() does not do anything. However, it still reports to
the profiler that there
On Monday, 28 December 2015 at 12:58:36 UTC, Gary Willoughby
wrote:
On Sunday, 27 December 2015 at 22:42:21 UTC, Ivan Kazmenko
wrote:
Or do you mean you want to print variables in order without
modifying the array? Sounds like this would require at least
N log N time and N additional memory fo
On Monday, 28 December 2015 at 14:24:04 UTC, Basile B. wrote:
On Wednesday, 23 December 2015 at 00:59:53 UTC, steven kladitis
wrote:
...
All of the programs are from RosettaCode.org. The script to
compile them generates a log file and you will see a few that
the linker just stops No idea
Hi,
While solving Advent of Code problems for fun (already discussed
in the forum:
http://forum.dlang.org/post/cwdkmblukzptsrsrv...@forum.dlang.org), I ran into an issue. I wanted to test for the pattern "two consecutive characters, arbitrary sequence, the same two consecutive characters". Sa
On Wednesday, 30 December 2015 at 11:06:55 UTC, Ivan Kazmenko
wrote:
...
As you can see, bmatch (usage discouraged in the docs) gives me
the result I want, but match (also discouraged) and matchAll
(way to go) don't.
Am I misusing matchAll, or is this a bug?
Reported as https://issues.dlan
On Friday, 1 January 2016 at 12:29:01 UTC, anonymous wrote:
On 30.12.2015 12:06, Ivan Kazmenko wrote:
As you can see, bmatch (usage discouraged in the docs) gives
me the
result I want, but match (also discouraged) and matchAll (way
to go) don't.
Am I misusing matchAll, or is this a bug?
The
On Friday, 8 January 2016 at 15:45:52 UTC, zabruk70 wrote:
Should i create bugreport, or this is my mistake?
Same here:
rdmd moduleA.d works.
rdmd -g moduleA.d produces a linker error.
What's more:
rdmd -m64 -g moduleA.d fails, and
rdmd -m64 moduleA.d also fails.
I have dmd 2.069.2 here. Olde
On Friday, 29 January 2016 at 07:17:04 UTC, glathoud wrote:
I have the impression that function implementations are not
merged:
return fun0(fun1(a));
For example, fun1(a) outputs a temporary array, which is then
used as input for fun0. Merging the implementations of fun0 and
fun1 would e
Hi,
1. What works.
Inside a function (outerFun), I've got inner functions fun1 and
fun2 which have to recursively call each other. Just writing
them one after the other does not work. I've managed to find a
trick to make it work though, which is to add empty compile-time
parameters to fun1
On Wednesday, 3 February 2016 at 15:09:35 UTC, Adam D. Ruppe
wrote:
Read my post here:
http://stackoverflow.com/questions/34398408/struct-declaration-order/34398642#34398642
then see if you can use the same reasoning on your problem.
This indeed works without any other tricks such as compile-
On Wednesday, 3 February 2016 at 22:09:37 UTC, sigod wrote:
On Wednesday, 3 February 2016 at 19:21:06 UTC, Meta wrote:
Ah, I see. I'd like to test something; can you please change
`(a) => a * a` to
`(int a) => a * a` and post the results?
This works.
http://dpaste.dzfl.pl/92c254ef6cf6
Seem
On Friday, 19 February 2016 at 23:56:29 UTC, Lisa wrote:
Can you please help me and explain how to create a program,
which would find area of triangle and its perimeter?
First, one can't find these unless something is given. So, what
is given: sides? angles? two-dimensional coordinates?
The
On Saturday, 20 February 2016 at 04:15:50 UTC, Lisa wrote:
module main;
import std.stdio;
import std.math;
int main() {
int A, B, C;
writef("A = ");
readf("%lf", %A);
writef("B = ");
readf("%lf", %B);
writef("C1= ");
readf("%lf", %C);
On Sunday, 21 February 2016 at 12:35:31 UTC, Lisa wrote:
...
Is there smth wrong again?
Yes.
As a programmer, most of the time, you will have to try your
programs by yourself before you consider them correct.
Now, run a compiler, and it complains:
-
main.d(20): Error: cannot return non-
On Friday, 22 April 2016 at 17:37:44 UTC, Nordlöw wrote:
Have anybody implement Ada-style modulo types
https://en.wikibooks.org/wiki/Ada_Programming/Types/mod
I've implemented a proof-of-concept for algorithmic programming
competitions [1]. In these competitions, quite a few problems ask
to
On Saturday, 23 April 2016 at 10:40:13 UTC, salvari wrote:
It seems to be really simple, I read the columns name with no
problem. But as soon as the program parses the first line of
data, the array containing the columns names seems to be
overwrited.
Another possibility yet not mentioned is t
On Saturday, 31 May 2014 at 21:22:48 UTC, Joseph Rushton Wakeling
via Digitalmars-d-learn wrote:
On 31/05/14 22:37, Joseph Rushton Wakeling via
Digitalmars-d-learn wrote:
On 30/05/14 22:45, monarch_dodra via Digitalmars-d-learn wrote:
Didn't you make changes to how and when the global PRNG is
p
The D language pays certain attention to avoiding hijacking [1].
So I was surprised when I hijacked a function override from a
template mixin by mistake. Here is a commented example. The
comments explain the relevant part of the life cycle of the
program.
-
// Start with class A with m
On Monday, 9 June 2014 at 16:13:50 UTC, monarch_dodra wrote:
On Monday, 9 June 2014 at 15:54:21 UTC, Ivan Kazmenko wrote:
I'd expect a "multiple overrides of same function" error, much
like if I just paste the mixin code by hand. Is that a bug or
working by design? In the latter case, please
On Tuesday, 1 July 2014 at 13:03:54 UTC, Vlad Levenfeld wrote:
I was mistaken earlier, decrementing the length counter also
sets the capacity to 0.
Besides just learning to use assumeSafeAppend (as mentioned
already), I'd also recommend reading the article on D slices to
deeper understand the
Also, there is std.array.array for the ranges you want to convert
to arrays.
For example, if "a" is an array, "a.map!(x => x * 2).array"
produces an new array of doubled values (as opposed to a lazy
range produced by std.algorithm.map).
Hi!
The following code does not correctly handle Unicode strings.
-
import std.stdio;
void main () {
string s;
readf ("%s", &s);
write (s);
}
-
Example input ("Test." in cyrillic):
-
Тест.
-
(hex: D0 A2 D0 B5 D1 81 D1 82 2E 0D 0A)
Example output:
-
Т
On Monday, 3 November 2014 at 19:37:20 UTC, Ivan Kazmenko wrote:
readf ("%s", &s);
Worth noting: this reads to end-of-file (not end-of-line or
whitespace), and reading the whole file into a string was what I
indeed expected it to do.
So, if there is an idiomatic way to read the whol
On Monday, 3 November 2014 at 20:03:03 UTC, Ali Çehreli wrote:
On 11/03/2014 11:47 AM, Ivan Kazmenko wrote:
On Monday, 3 November 2014 at 19:37:20 UTC, Ivan Kazmenko
wrote:
readf ("%s", &s);
Worth noting: this reads to end-of-file (not end-of-line or
whitespace),
and reading the whole fil
On Monday, 3 November 2014 at 20:10:02 UTC, Gary Willoughby wrote:
On Monday, 3 November 2014 at 19:47:17 UTC, Ivan Kazmenko wrote:
So, if there is an idiomatic way to read the whole file into a
string which is Unicode-compatible, it would be great to learn
that, too.
Maybe something like thi
On Tuesday, 4 November 2014 at 11:46:24 UTC, Kagamin wrote:
https://issues.dlang.org/show_bug.cgi?id=12990 this?
Similar, but not quite that. Bugs 12990 and 1448 (linked from
there) seem to have Windows console as an important part of the
process. For me, the example does not work even with
On Tuesday, 4 November 2014 at 13:01:48 UTC, anonymous wrote:
On Monday, 3 November 2014 at 19:37:20 UTC, Ivan Kazmenko wrote:
Hi!
The following code does not correctly handle Unicode strings.
-
import std.stdio;
void main () {
string s;
readf ("%s", &s);
write (s);
On Tuesday, 4 November 2014 at 18:09:48 UTC, Ivan Kazmenko wrote:
On Monday, 3 November 2014 at 20:10:02 UTC, Gary Willoughby
wrote:
On Monday, 3 November 2014 at 19:47:17 UTC, Ivan Kazmenko
wrote:
So, if there is an idiomatic way to read the whole file into
a string which is Unicode-compatible
Hi!
This gives an error (cannot deduce template function from
argument types):
-
import std.algorithm;
void main () {
char [] c;
sort (c);
}
-
Why is "char []" so special that it can't be sorted?
For example, if I know the array contains only ASCII characters,
sortin
On Wednesday, 5 November 2014 at 13:34:05 UTC, Marc Schütz wrote:
On Wednesday, 5 November 2014 at 12:54:03 UTC, Ivan Kazmenko
wrote:
Hi!
This gives an error (cannot deduce template function from
argument types):
-
import std.algorithm;
void main () {
char [] c;
sort (c);
IK>> For example, isRandomAccessRange[0] states the problem:
IK>> -
IK>> Although char[] and wchar[] (as well as their qualified
IK>> versions including string and wstring) are arrays,
IK>> isRandomAccessRange yields false for them because they use
IK>> variable-length encodings (UTF-8 and UTF
IK>> Why is "char []" so special that it can't be sorted?
SS> Because sort works on ranges, and std.range has the view that
SS> char[] is a range of dchar without random access. Nevermind
SS> what the compiler thinks :)
SS>
SS> I believe you can get what you want with
SS> std.string.representatio
Hi!
I'm unsure what is the Russian equivalent for the term "range",
as in "D range", the generalization of a pair of iterators. With
"range" being such an overloaded term in source language and
having no exact equivalent in the target language, its Russian
translations I have come up with do
I was thinking about list comprehension, which is what
programming on ranges is. Isn't it?
"list" is a good term, but it's already taken. so naming
"range" as
"list" will create unnecessary confusion. alas. yet "набор" is
short
and easy, and it's not widely used, as "set" is translated as
"множ
On Sunday, 16 November 2014 at 15:08:10 UTC, JR wrote:
On Sunday, 16 November 2014 at 14:16:55 UTC, Artem Tarasov
wrote:
writefln("%(%s-%)", ["a", "b", "c"]) doesn't print the
intended a-b-c but surrounds each string with double quotes -
"a"-"b"-"c", which I find inconsistent with the fact that
On Wednesday, 12 November 2014 at 20:48:00 UTC, Jack Applegame
wrote:
"интервал", "область"
Thanks to all for the suggestions and reasoning!
I don't yet see a word which "clicks" in this case, but we got
multiple reasonable suggestions here. Perhaps I'll be fine with
one of them.
Ivan Kaz
On Wednesday, 24 December 2014 at 06:47:26 UTC, Joel wrote:
I can't get implib.exe (http://ftp.digitalmars.com/bup.zip) to
produce .lib files from dlls (https://www.allegro.cc/files/). I
think it works for other people.
Thanks for any help.
Reading Part II of this answer on Stackoverflow may
On Friday, 30 January 2015 at 20:34:53 UTC, RuZzz wrote:
What do I need to learn?
c["BTC"]["N-01"] = 1.0002;//Error: cannot implicitly convert
expression (1) of type double to
axfinance.api.currencies.Currencies
As I see it, there is no constructor in your class with a double
argument.
On Saturday, 31 January 2015 at 13:45:22 UTC, RuZzz wrote:
I want to understand the correct architecture of the class.
Sorry, you still did not state your problem (or what you are
trying to achieve) clearly.
Writing down a clear problem description is likely to get you
halfway to the solution
There is an approxEqual in std.math, in addition in feqrel:
http://dlang.org/phobos/std_math.html#.approxEqual
It takes maximum absolute and relative difference as arguments.
On Monday, 16 February 2015 at 19:52:20 UTC, Dennis Ritchie wrote:
Hi.
And how to read Data from the input stream?
import std.stdio;
import std.bigint;
void main() {
BigInt n;
readf(" %?", &n);
writeln(n);
}
The readf function does not seem to support reading BigInt
Hi,
I was just refactoring a project to compile under 2.067.
The fixes themselves were trivial: just adding "import
std.traits;" to some files. Apparently its pieces were publicly
imported by another module in 2.066. So, it's the right fix
anyway.
Understanding what happened, however, too
On Thursday, 19 March 2015 at 10:21:09 UTC, Vladimir Panteleev
wrote:
On Tuesday, 17 March 2015 at 15:11:02 UTC, Ivan Kazmenko wrote:
For the former problem, is there a tool which jumps out and
tells you use Phobos without importing things properly, or
suggests a Phobos import by the name of th
On Thursday, 19 March 2015 at 16:06:31 UTC, Vladimir Panteleev
wrote:
On Thursday, 19 March 2015 at 14:32:53 UTC, Ivan Kazmenko wrote:
Hey, I also happen to use Far Manager and its internal editor,
at least for simple projects. Is that dcheck triggering a Far
plugin? I have a bit of experienc
On Saturday, 21 March 2015 at 14:31:20 UTC, Dennis Ritchie wrote:
In C++ it is fully working:
char s[25], t[25];
scanf("%s%s", s, t);
Indeed.
Generate a 10-character string:
-
import std.range, std.stdio;
void main () {'a'.repeat (10).writeln;}
-
Try to copy it with D
On Saturday, 21 March 2015 at 16:34:44 UTC, Dennis Ritchie wrote:
And why in D copied only the first 32767 characters of the
string? I'm more days couldn't understand what was going on...
To me, it looks like a bug somewhere, though I don't get where
exactly. Is it in bits of DigitalMars C/C+
On Friday, 20 March 2015 at 18:37:57 UTC, Vladimir Panteleev
wrote:
On Friday, 20 March 2015 at 18:36:19 UTC, Vladimir Panteleev
wrote:
On Friday, 20 March 2015 at 18:05:07 UTC, Ivan Kazmenko wrote:
Thanks. I was able to reproduce the workflow you showed in
the gif to the part where an error p
On Tuesday, 24 March 2015 at 15:45:36 UTC, Dennis Ritchie wrote:
Tell me, please, how can I replace this code?
import std.conv : to;
import std.bigint : BigInt;
import std.string : format;
import std.stdio : writeln;
void main() {
BigInt[10] bitArr;
ulong n = 18_446_724_073_70
On Wednesday, 25 March 2015 at 20:02:20 UTC, Ivan Kazmenko wrote:
(2) The documentation says it is more efficient than the first
version in the number of comparisons (verbose lambda with plain
sort) [1], but I don't get how it is possible: unless we know
than (not pred1(a,b)) and (not !pred1(a,
On Wednesday, 25 March 2015 at 19:32:43 UTC, Dennis Ritchie wrote:
On Wednesday, 25 March 2015 at 19:01:43 UTC, bearophile wrote:
One solution:
Thanks.
On Wednesday, 25 March 2015 at 19:03:27 UTC, bearophile wrote:
But calling "count" for each item is not efficient (in both C#
and D). If you
On Wednesday, 25 March 2015 at 20:02:20 UTC, Ivan Kazmenko wrote:
Will file an issue soon.
Here it is:
https://issues.dlang.org/show_bug.cgi?id=14340
And another one, a 2.067 regression:
https://issues.dlang.org/show_bug.cgi?id=14341
On Wednesday, 25 March 2015 at 20:09:53 UTC, bearophile wrote:
Dennis Ritchie:
A more effective solution for C ++:
#include
#include
#include
int main() {
using namespace ranges;
auto rng = istream( std::cin )
| to_vector
| action::sort
| view::group_by( st
On Wednesday, 25 March 2015 at 20:17:57 UTC, bearophile wrote:
Ivan Kazmenko:
(1) For me, the name of the function is obscure. Something
like sortBy would be a lot easier to find than schwartzSort.
I've asked to change the name of that function for years. But
Andrei Alexandrescu is a adaman
On Sunday, 29 March 2015 at 20:05:22 UTC, Nordlöw wrote:
What's the most efficient way to extract a the storage from a
BinaryHeap and then sort it?
Is there a better way other than
binaryHeap.release.sort
than makes use of the heap property? For example
while (!binaryHeap.empty)
On Tuesday, 14 April 2015 at 14:21:41 UTC, Dennis Ritchie wrote:
writefln("[%([%(%s, %)]%|\n %)]", [a[4][4 .. $], a[5][4 .. $],
a[6][4 .. $], a[7][4 .. $]]);
At least this can be done as
-
writefln("[%([%(%s, %)]%|\n %)]", a[4..8].map !(b => b[4 .. $]));
-
On Saturday, 11 April 2015 at 22:45:39 UTC, Dennis Ritchie wrote:
I also want to know whether it is possible to D somehow set the
maximum width of the print string in characters?
-
void main() {
import std.stdio, std.range;
writefln(";; %(%s, %)).", iota(10, 1101));
}
-
Yes, it's a lot better but I did not get to concatenate the
string ";;" in each paragraph:
-
import std.conv, std.stdio, std.range, std.string;
void main() {
auto a = iota(10, 1101).text;
a = a[1 .. $ - 1], a ~= '.';
writeln(wrap(a, 30));
}
-
http://ideone.com
On Friday, 24 April 2015 at 18:55:07 UTC, Steven Schveighoffer
wrote:
Thanks to all of you for the solutions, but what if the
hex-string
exceeds the limit of ulong, for instance
"123456789ABCDEF0123456789ABCDEF1234". How to convert them to a
ulong-array?
Well, technically, a hex string can be
On Tuesday, 28 April 2015 at 10:46:54 UTC, Gary Willoughby wrote:
After reading the following thread:
http://forum.dlang.org/thread/nczgumcdfystcjqyb...@forum.dlang.org
I wondered if it was possible to write a classic fizzbuzz[1]
example using a UFCS chain? I've tried and failed.
[1]: http:/
On Thursday, 14 May 2015 at 00:29:06 UTC, Dennis Ritchie wrote:
Why doesn't the compiler produces an error?
-
import std.stdio;
void main() {
writeln({});
}
-
http://ideone.com/qTZCAd
Somehow reminds me of this lambda:
https://github.com/Hackerpilot/Idiotmatic-D/blob/master/id
On Tuesday, 19 May 2015 at 10:00:33 UTC, BlackEdder wrote:
The documentation seems to indicate that partialShuffle:
Partially shuffles the elements of r such that upon returning
r[0..n] is a random subset of r, (which is what I want), but it
seems that partialShuffle actually only shuffles the
Hello,
I wrap an array into a struct. Then I use alias this to expose
the array functionality. Sadly, range properties of the array
are not forwarded, and so I can't use the struct as an array with
functions from std.algorithm and std.range.
-
import std.range, std.stdio;
struct S {
On Wednesday, 29 July 2015 at 12:25:14 UTC, Marc Schütz wrote:
On Tuesday, 28 July 2015 at 21:25:23 UTC, Ivan Kazmenko wrote:
Hello,
I wrap an array into a struct. Then I use alias this to
expose the array functionality. Sadly, range properties of
the array are not forwarded, and so I can't
On Wednesday, 29 July 2015 at 23:54:29 UTC, Ivan Kazmenko wrote:
On Wednesday, 29 July 2015 at 12:25:14 UTC, Marc Schütz wrote:
On Tuesday, 28 July 2015 at 21:25:23 UTC, Ivan Kazmenko wrote:
...
Perhaps I still don't implement save() correctly.
The line
@property auto save() {return S(con
On Tuesday, 18 August 2015 at 16:51:01 UTC, ixid wrote:
On Tuesday, 18 August 2015 at 16:02:42 UTC, cym13 wrote:
On Tuesday, 18 August 2015 at 15:51:55 UTC, ixid wrote:
Though sugar seems to be somewhat looked down upon I thought
I'd suggest this- having seen the cartesianProduct function
from
Hi.
I want to somehow list members of a class in the order of their
declaration. The immediate goal is to generate a few functions,
like the "default" constructor for structs but only with all the
fields, or the "reader" function, but I'm interested in the
general question as well.
I can g
On Thursday, 10 November 2016 at 10:16:44 UTC, Ivan Kazmenko
wrote:
I want to somehow list members of a class in the order of their
declaration.
Bump. Anyone? I've met my immediate goal by other means, but
the general question remains.
If classes are no-go, basically, any aggregate will do
1 - 100 of 128 matches
Mail list logo