Re: length's type.

2024-02-13 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: HTTP Post Body Parameters

2023-08-01 Thread Ivan Kazmenko via Digitalmars-d-learn
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?

Re: A New Era for the D Community

2023-05-04 Thread Ivan Kazmenko via Digitalmars-d-announce
On Wednesday, 3 May 2023 at 11:13:34 UTC, Mike Parker wrote: ... Our enthusiasm is high, and we're ready to get going. I think you'll like where we're headed. Interesting. Good luck with the endeavor! Ivan Kazmenko.

Re: Breaking ";" rule with lambda functions

2022-08-01 Thread Ivan Kazmenko via Digitalmars-d-learn
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

vectorization of a simple loop -- not in DMD?

2022-07-11 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: Release D 2.100.0

2022-05-15 Thread Ivan Kazmenko via Digitalmars-d-announce
On Sunday, 15 May 2022 at 11:05:38 UTC, Martin Nowak wrote: Glad to announce D 2.100.0, ♥ to the 41 contributors. Congratulations on the milestone number! Ivan Kazmenko.

Re: d strings are the bane of my existance

2021-12-06 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: Release Candidate 2.097.0 [was: Re: Beta 2.097.0]

2021-05-29 Thread Ivan Kazmenko via Digitalmars-d-announce
On Saturday, 29 May 2021 at 11:00:50 UTC, Martin Nowak wrote: On Thursday, 13 May 2021 at 13:29:55 UTC, Martin Nowak wrote: Glad to announce the first beta for the 2.097.0 release, ♥ to the 54 contributors. http://dlang.org/download.html#dmd_beta http://dlang.org/changelog/2.097.0.html

Re: Map of functions

2018-12-14 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: dmd64 on Windows: how?

2018-08-12 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: dmd64 on Windows: how?

2018-08-11 Thread Ivan Kazmenko via Digitalmars-d-learn
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:

dmd64 on Windows: how?

2018-08-10 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: On D in competitive programming

2018-07-31 Thread Ivan Kazmenko via Digitalmars-d-announce
On Tuesday, 31 July 2018 at 00:52:22 UTC, 9il wrote: Are competitors allowed to use mir-algorithm and mir-random? The libraries can be used for graphs (Tarjan algorithm), matrices/tensors, nd-iteration, RNGs, interpolation, and distributions? Sadly, no: most of the time, language compilers

Re: On D in competitive programming

2018-07-30 Thread Ivan Kazmenko via Digitalmars-d-announce
On Monday, 30 July 2018 at 19:44:32 UTC, Steven Schveighoffer wrote: a lifetime ago, I competed using topcoder (and wrote a bunch of problem sets for them too). Topcoder had a "challenge" phase, where you could challenge the solutions of others. Nice! I just found your profile and problem

Re: On D in competitive programming

2018-07-29 Thread Ivan Kazmenko via Digitalmars-d-announce
On Sunday, 29 July 2018 at 07:51:00 UTC, Jim Balter wrote: Actually, map!something does not drop empty parentheses, so mentioning that does not help. Parentheses containing 0 or 1 arguments can be omitted ... and you omit them for 1 argument in 3 places, and no instances of omitted empty

Re: On D in competitive programming

2018-07-28 Thread Ivan Kazmenko via Digitalmars-d-announce
Thanks for the feedback! On Saturday, 28 July 2018 at 20:33:14 UTC, Cym13 wrote: 1. Your real name isn't written in the article so the link "with some successes" won't tell much to someone that doesn't already know you Hmm, didn't think of it. I phrased it differently now. In my

On D in competitive programming

2018-07-28 Thread Ivan Kazmenko via Digitalmars-d-announce
Hey, I wrote a post with my general reflections on using D in competitive programming. Mostly compared to C++, since that's what more than 90% of people use for it. The post is tailored to cover only the competitive programming specifics. http://codeforces.com/blog/entry/60890 (en+ru, the

Re: opCmp / opEquals do not actually support partial orders

2018-07-18 Thread Ivan Kazmenko via Digitalmars-d
On Wednesday, 18 July 2018 at 15:13:24 UTC, rikki cattermole wrote: On 19/07/2018 3:03 AM, Ivan Kazmenko wrote: That's by DMD32 on Windows.  (Sorry, my DMD64 broke after upgrading Visual Studio to 2017, and I failed to fix it right now.  Anyway, it's not like x86_64 uses a different set of

Re: opCmp / opEquals do not actually support partial orders

2018-07-18 Thread Ivan Kazmenko via Digitalmars-d
On Wednesday, 18 July 2018 at 14:02:28 UTC, Dominikus Dittes Scherkl wrote: On Wednesday, 18 July 2018 at 13:12:05 UTC, Ivan Kazmenko wrote: Leaving x uninitialized, or using floats, work about the same. No, floats are a whole lot less slow. Are they? Locally, I don't see much difference.

Re: opCmp / opEquals do not actually support partial orders

2018-07-18 Thread Ivan Kazmenko via Digitalmars-d
On Tuesday, 17 July 2018 at 21:18:12 UTC, John Colvin wrote: Just do what std.typecons.Proxy does and return float.nan for the incomparable case. Isn't it slow though on current processors? I just threw together a test program. - import std.datetime.stopwatch, std.math, std.stdio;

Re: dmd optimizer now converted to D!

2018-07-05 Thread Ivan Kazmenko via Digitalmars-d
On Thursday, 5 July 2018 at 14:30:05 UTC, Dukc wrote: foreach(j, ref piece; cast(int[4][]) a) { auto pieceI = j * 4; static foreach(i; 0 .. piece.length) piece[i] = pieceI + i; } Can probably be made even better by designing some template helper. Thanks! The cast to an array of

Re: dmd optimizer now converted to D!

2018-07-05 Thread Ivan Kazmenko via Digitalmars-d
On Thursday, 5 July 2018 at 14:05:42 UTC, Seb wrote: FYI: you can introduce scopes with static foreach to declare new variables: for (int i = 0; i < 4 * n; i += 4) { static foreach (k; 0..4) {{ auto idx = i + k a[idx] += idx; }} } Thanks! The two parentheses trick

Re: dmd optimizer now converted to D!

2018-07-05 Thread Ivan Kazmenko via Digitalmars-d
On Wednesday, 4 July 2018 at 17:22:22 UTC, H. S. Teoh wrote: ... dmd *is* capable of things like strength reduction and code lifting, but as Walter himself has said, it does *not* implement loop unrolling. Ow! I always thought it did loop unrolling in some cases, I was just never lucky when

Re: how to correctly populate an array of dynamic closures?

2018-03-29 Thread Ivan Kazmenko via Digitalmars-d-learn
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 () =>

how to correctly populate an array of dynamic closures?

2018-03-29 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: Seeking lecturer - D language (Moscow)

2018-03-15 Thread Ivan Kazmenko via Digitalmars-d-announce
On Wednesday, 14 March 2018 at 11:38:20 UTC, Dmitry Olshansky wrote: At the moment it’s a bit early stage but we are looking for enthusiast who has spare time and desire to spread the knowledge of D supremacy among students. The course will replace an equivalent of 1 year C++ course, but may

Re: An unfortunate quirk of DMD32 converting floating-point to string

2017-12-28 Thread Ivan Kazmenko via Digitalmars-d
On Tuesday, 26 December 2017 at 23:58:43 UTC, Walter Bright wrote: On 12/26/2017 3:41 PM, Ivan Kazmenko wrote: While exploring quirks of floating-point values, as well as C/C++/D convenience with them, I stumbled on, in essence, the following (DMD32 on Windows): The issue is really with the

An unfortunate quirk of DMD32 converting floating-point to string

2017-12-26 Thread Ivan Kazmenko via Digitalmars-d
While exploring quirks of floating-point values, as well as C/C++/D convenience with them, I stumbled on, in essence, the following (DMD32 on Windows): void main () { import std.stdio : writefln; double x = 128.0;// same for real or float writefln ("%.20a", x); //

Re: run.dlang.io - a modern way to run D code

2017-12-14 Thread Ivan Kazmenko via Digitalmars-d-announce
On Thursday, 14 December 2017 at 01:52:29 UTC, H. S. Teoh wrote: ... This can, of course, be bound to a custom keybinding, then you'll have your one-stop shop for compiling D snippets without ever seeing (much less typing) any temporary filenames. And without needing an internet connection.

Re: Russian AI Cup 2017 - D language support

2017-11-18 Thread Ivan Kazmenko via Digitalmars-d-announce
On Friday, 17 November 2017 at 22:54:47 UTC, Steven Schveighoffer wrote: Cool! Is there any history of people using D in the past for this competition? A few people used D each year it had support, to various success. The highest so far, I think, is Vladislav Isenbaev in 2013. He got 11-th

Russian AI Cup 2017 - D language support

2017-11-17 Thread Ivan Kazmenko via Digitalmars-d-announce
Hi! Russian AI Cup (http://russianaicup.ru) is an annual online AI programming competition by Mail.Ru Group. This year, the task is to write a bot which plays a real-time strategy against other programmer's bots. The competition runs from November 13 to December 24, 2017, and the first

Re: Why 2 ^^ 1 ^^ 2 = 2?

2017-10-27 Thread Ivan Kazmenko via Digitalmars-d-learn
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.

Re: Why 2 ^^ 1 ^^ 2 = 2?

2017-10-22 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: floating point value rounded to 6digits

2017-09-19 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: floating point value rounded to 6digits

2017-09-19 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: writeln() sometimes double prints from main() if I run a thread checking for input?

2017-08-31 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: writeln() sometimes double prints from main() if I run a thread checking for input?

2017-08-31 Thread Ivan Kazmenko via Digitalmars-d-learn
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:

Re: writeln() sometimes double prints from main() if I run a thread checking for input?

2017-08-30 Thread Ivan Kazmenko via Digitalmars-d-learn
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().start; writeln("Output"); writeln("Output2");

Re: writeln() sometimes double prints from main() if I run a thread checking for input?

2017-08-30 Thread Ivan Kazmenko via Digitalmars-d-learn
On Wednesday, 30 August 2017 at 10:55:20 UTC, Timothy Foster wrote: import std.stdio, core.thread; void main(){ auto thread = new Thread().start; writeln("Output"); writeln("Output2"); writeln("Output3"); while(true){} } void func(){

Re: writeln() sometimes double prints from main() if I run a thread checking for input?

2017-08-30 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: Get complete function declaration

2017-07-18 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: Avoid if statements for checking neighboring indexes in a 2D array

2017-07-17 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: Avoid if statements for checking neighboring indexes in a 2D array

2017-07-17 Thread Ivan Kazmenko via Digitalmars-d-learn
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);

Re: Avoid if statements for checking neighboring indexes in a 2D array

2017-07-16 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: implib.exe no output files

2017-06-21 Thread Ivan Kazmenko via Digitalmars-d-learn
On Monday, 19 June 2017 at 23:11:29 UTC, Joel wrote: On Sunday, 18 June 2017 at 09:48:31 UTC, Ivan Kazmenko wrote: On Sunday, 18 June 2017 at 07:41:27 UTC, Joel wrote: I got the file here: http://ftp.digitalmars.com/bup.zip It works on other computers. I was trying to update to the latest

Re: implib.exe no output files

2017-06-18 Thread Ivan Kazmenko via Digitalmars-d-learn
On Sunday, 18 June 2017 at 07:41:27 UTC, Joel wrote: I got the file here: http://ftp.digitalmars.com/bup.zip It works on other computers. I was trying to update to the latest DAllegro (https://github.com/SiegeLord/DAllegro5). Though, I used another computer for the lib files and still

Re: Help with an algorithm!

2017-06-15 Thread Ivan Kazmenko via Digitalmars-d-learn
On Thursday, 15 June 2017 at 13:41:07 UTC, MGW wrote: On Thursday, 15 June 2017 at 13:16:24 UTC, CRAIG DILLABAUGH wrote: The purpose - search of changes in file system. Sorting is a slow operation as well as hashing. Creation of a tree, is equally in sorting. So far the best result:

Re: Help with an algorithm!

2017-06-15 Thread Ivan Kazmenko via Digitalmars-d-learn
On Thursday, 15 June 2017 at 06:06:01 UTC, MGW wrote: There are two arrays of string [] mas1, mas2; Size of each about 5M lines. By the size they different, but lines in both match for 95%. It is necessary to find all lines in an array of mas2 which differ from mas1. The principal criterion -

Re: D now available on Codefights.com

2017-06-14 Thread Ivan Kazmenko via Digitalmars-d-announce
On Wednesday, 14 June 2017 at 08:32:43 UTC, Dsby wrote: On Wednesday, 14 June 2017 at 01:17:12 UTC, Ivan Kazmenko wrote: Hey, The site https://codefights.com is a place to test and improve your programming skills. The challenges include interview-type problems, shortest code contests, duels

D now available on Codefights.com

2017-06-13 Thread Ivan Kazmenko via Digitalmars-d-announce
Hey, The site https://codefights.com is a place to test and improve your programming skills. The challenges include interview-type problems, shortest code contests, duels with other coders, monthly tournaments, and more. If you perform well, you can opt in to get connected with partner

Re: DMD [-O flag] vs. [memory allocation in a synchronized class]

2017-06-08 Thread Ivan Kazmenko via Digitalmars-d-learn
On Thursday, 8 June 2017 at 15:35:06 UTC, Ivan Kazmenko wrote: Perhaps a regression should be filed, or searched for, at issues.dlang.org. I can do it, but not right now, and would be glad if someone beats me to it. Reported: https://issues.dlang.org/show_bug.cgi?id=17481

Re: DMD [-O flag] vs. [memory allocation in a synchronized class]

2017-06-08 Thread Ivan Kazmenko via Digitalmars-d-learn
On Thursday, 8 June 2017 at 11:41:40 UTC, realhet wrote: I've managed to narrow the problem even more: //win32 dmd -O class Obj{ synchronized void trigger(){ new ubyte[1]; } } void main(){ auto k = new shared Obj; k.trigger; } This time I got a more sophisticated error message:

Re: Why does phobos have collisions?

2017-06-07 Thread Ivan Kazmenko via Digitalmars-d
On Wednesday, 7 June 2017 at 10:01:30 UTC, Mike B Johnson wrote: Error: template std.algorithm.mutation.strip cannot deduce function from argument types !()(string), candidates are: src\phobos\std\algorithm\mutation.d(2280): std.algorithm.mutation.strip(Range, E)(Range range, E element)

Re: Rosetta Commatizing numbers

2017-06-01 Thread Ivan Kazmenko via Digitalmars-d-learn
On Thursday, 1 June 2017 at 08:45:23 UTC, Solomon E wrote: On Wednesday, 31 May 2017 at 15:44:51 UTC, Ivan Kazmenko wrote: So, two custom calls, two minor changes, no sweat. Is everything right now? Even if not: that was fast, we can do another iteration. When we have a short

Re: Rosetta Commatizing numbers

2017-05-31 Thread Ivan Kazmenko via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 13:27:24 UTC, Solomon E wrote: Fine, by the numbers: 1. pi has the commas start at the wrong digit, and doesn't follow the explicit instructions to use spaces as the separator and a grouping of 5 Can be solved by calling the function with a right set of

Re: Rosetta Commatizing numbers

2017-05-30 Thread Ivan Kazmenko via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 04:31:14 UTC, Ivan Kazmenko wrote: Now, where is the old version wrong? ... Actually, it also changes every number in the string, not only the first one as required. Because of that, it also fails the "do not touch the exponent" requirement. Sadly, both are

Re: Rosetta Commatizing numbers

2017-05-30 Thread Ivan Kazmenko via Digitalmars-d-learn
On Tuesday, 30 May 2017 at 10:54:49 UTC, Solomon E wrote: I ran into a Rosetta code solution in D that had obvious errors. It's like the author or the previous editor wasn't even trying to do it right, like a protest against how many detailed rules the task had. I assumed that's not the way we

Re: How to avoid throwing an exceptions for a built-in function?

2017-05-10 Thread Ivan Kazmenko via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 12:40:41 UTC, k-five wrote: I have a line of code that uses "to" function in std.conv for a purpose like: int index = to!int( user_apply[ 4 ] ); // string to int When the user_apply[ 4 ] has value, there is no problem; but when it is empty: "" it throws an

Re: [OT] Algorithm question

2017-05-02 Thread Ivan Kazmenko via Digitalmars-d
On Tuesday, 2 May 2017 at 10:35:46 UTC, Ivan Kazmenko wrote: I hope some part of the idea is still salvageable. For example, what if we put the intervals in a queue instead of a stack? I tried to implement a similar approach, but instead of a queue or a stack, I used a random-access array of

Re: [OT] Algorithm question

2017-05-02 Thread Ivan Kazmenko via Digitalmars-d
On Monday, 1 May 2017 at 21:54:43 UTC, MysticZach wrote: On Monday, 1 May 2017 at 16:56:58 UTC, MysticZach wrote: The goal is to have the first hit be the one you return. The method: if a random pick doesn't satisfy, randomly choose the partition greater than or less than based on

Re: [OT] Algorithm question

2017-05-01 Thread Ivan Kazmenko via Digitalmars-d
On Monday, 1 May 2017 at 04:15:35 UTC, H. S. Teoh wrote: Given a set A of n elements (let's say it's a random-access range of size n, where n is relatively large), and a predicate P(x) that specifies some subset of A of elements that we're interested in, what's the best algorithm (in terms of

Re: Problem with using readln.

2017-04-30 Thread Ivan Kazmenko via Digitalmars-d-learn
On Sunday, 30 April 2017 at 02:07:48 UTC, JV wrote: Hello i'm kinda new to D language and i wanted to make a simple program but somehow my input does no go to my if statements and just continues to ask for the user to input.Kindly help me One way would be: import std.stdio; int x;

Re: Release D 2.074.0

2017-04-10 Thread Ivan Kazmenko via Digitalmars-d-announce
On Monday, 10 April 2017 at 20:09:40 UTC, Martin Nowak wrote: Glad to announce D 2.074.0. [...] http://dlang.org/download.html http://dlang.org/changelog/2.074.0.html Thank you for producing the releases! I noticed that the backend license in this release (at least the Windows .7z version)

Re: Zcoin implementation bug enabled attacker to create 548, 000 Zcoins

2017-03-09 Thread Ivan Kazmenko via Digitalmars-d
On Thursday, 9 March 2017 at 15:42:22 UTC, qznc wrote: I'm curious. Where does it make sense for opEquals to be non-pure? Likewise opCmp, etc. An example would be tracking the number of comparisons made. This sounds like debug information (and then, debug statement can be used to escape

Re: Can you read the next line while iterating over byLine?

2017-02-04 Thread Ivan Kazmenko via Digitalmars-d-learn
On Thursday, 2 February 2017 at 19:34:37 UTC, John Doe wrote: Thanks readln is perfect. Since I am calling readln in different places and I always need to remove the newline character I have line=line[0..$-1] all over my code. Is there are better way? "readln.strip" gives the line without

Re: Associative array literal: length wrong when duplicate keys found

2017-02-02 Thread Ivan Kazmenko via Digitalmars-d-learn
On Tuesday, 31 January 2017 at 19:45:33 UTC, Ivan Kazmenko wrote: On Tuesday, 31 January 2017 at 17:20:00 UTC, John Colvin wrote: It's a bug, please report it. The initializer should be statically disallowed. Anyway, I'll file a bug report. Hmm, found it:

Re: Associative array literal: length wrong when duplicate keys found

2017-01-31 Thread Ivan Kazmenko via Digitalmars-d-learn
On Tuesday, 31 January 2017 at 17:20:00 UTC, John Colvin wrote: It's a bug, please report it. The initializer should be statically disallowed. Adding a .dup works around the problem. OK. Hmm, but the real use case was a bit more complicated, more like: - int n = 10; foreach (i; 0..n)

Re: Partial arrays reclaimed?

2017-01-31 Thread Ivan Kazmenko via Digitalmars-d-learn
On Friday, 27 January 2017 at 23:22:17 UTC, Nick Sabalausky wrote: Suppose an array is being used like a FIFO: --- T[] slice; // Add: slice ~= T(); // Remove: slice = slice[1..$]; --- Assuming of course there's no other references to the memory, as

Associative array literal: length wrong when duplicate keys found

2017-01-31 Thread Ivan Kazmenko via Digitalmars-d-learn
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). At this point, I found out that when initializing the AA with

Re: Yield from function?

2017-01-31 Thread Ivan Kazmenko via Digitalmars-d-learn
On Monday, 30 January 2017 at 11:03:52 UTC, Profile Anaysis wrote: I need to yield from a complex recursive function too allow visualizing what it is doing. e.g., if it is a tree searching algorithm, I'd like to yield for each node so that the current state can be shown visually. I realize

Re: size of a string in bytes

2017-01-28 Thread Ivan Kazmenko via Digitalmars-d-learn
On Saturday, 28 January 2017 at 15:32:33 UTC, Nestor wrote: I want to know variable size in memory. For example, say I have an UTF-8 string of only 2 characters, but each of them takes 2 bytes. string length would be 2, but the content of the string would take 4 bytes in memory (excluding

Re: Trying to understand multidimensional arrays in D

2017-01-26 Thread Ivan Kazmenko via Digitalmars-d-learn
On Thursday, 26 January 2017 at 05:20:07 UTC, Profile Anaysis wrote: (On the contrary, declarations in C or C++ looks rather unintuitive from this perspective: `T a[4][5][6]` is means that `a` is an array of 4 arrays of 5 arrays of 6 arrays of `T`. Note how we have to read left-to-right but

Re: Trying to understand multidimensional arrays in D

2017-01-25 Thread Ivan Kazmenko via Digitalmars-d-learn
On Thursday, 26 January 2017 at 01:47:53 UTC, Profile Anaysis wrote: does this mean that have int[][4][4] matrix_history; backwards? int[4][4][] matrix_history; this creates even a more set of problems. In short, you are right, `int[4][4][]` is a dynamic array of `int[4][4]`. In

Re: switch to member

2017-01-14 Thread Ivan Kazmenko via Digitalmars-d-learn
On Saturday, 14 January 2017 at 11:32:10 UTC, Marc Schütz wrote: You can utilize a little-known `switch` syntax trick in combination with `foreach`. Because a `foreach` over tuples is unrolled at compile time, it works even if your fields don't have exactly the same types: That looks

Re: opOpAssign on object properties

2017-01-08 Thread Ivan Kazmenko via Digitalmars-d-learn
On Sunday, 8 January 2017 at 18:23:34 UTC, collerblade wrote: On Sunday, 8 January 2017 at 10:03:50 UTC, Ivan Kazmenko wrote: On Sunday, 8 January 2017 at 09:22:12 UTC, collerblade wrote: [...] 1. If you want the member variable to change, naturally, you should provide a getter property

Re: opOpAssign on object properties

2017-01-08 Thread Ivan Kazmenko via Digitalmars-d-learn
On Sunday, 8 January 2017 at 09:22:12 UTC, collerblade wrote: How can i do opOpAssign with properties?? 1. If you want the member variable to change, naturally, you should provide a getter property which returns a reference to that variable: ref Point location() @property {

Re: To use a scripting language or not to use a scripting language?

2017-01-06 Thread Ivan Kazmenko via Digitalmars-d
On Friday, 6 January 2017 at 14:19:34 UTC, Anton Pastukhov wrote: As a game developer I can recommend to use Lua. This language is tradtionally used in many games/game engines. Ironically, one of D's declared selling points is, according to https://dlang.org/overview.html: Who is D For?

Re: Adding linker paths with spaces using dmd and msvc toolchain

2016-12-30 Thread Ivan Kazmenko via Digitalmars-d-learn
On Friday, 30 December 2016 at 05:24:56 UTC, Jeremy DeHaan wrote: On Friday, 30 December 2016 at 04:56:59 UTC, Jerry wrote: On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan wrote: How does one correctly add a linker path that has spaces? The quotes get consumed by the command line.

Russian AI Cup 2016

2016-11-18 Thread Ivan Kazmenko via Digitalmars-d-announce
Hi. Russian AI Cup 2016: CodeWizards is an annual online competition organized by Mail.Ru Group. This year's task is to write a bot for a simple DOTA-like game. The competition is open for international participation: starting this year, there is an English translation for everything (it

Re: How to list aggregate members in order of declaration at compile time?

2016-11-11 Thread Ivan Kazmenko via Digitalmars-d-learn
On Friday, 11 November 2016 at 22:04:37 UTC, Jonathan M Davis wrote: ... I expect that it never occurred to Walter to specify that the order of the members mattered with tupleof and that that's why the spec doesn't say. So, use tupleof, and you can create an enhancement request in bugzilla

Re: How to list aggregate members in order of declaration at compile time?

2016-11-11 Thread Ivan Kazmenko via Digitalmars-d-learn
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

How to list aggregate members in order of declaration at compile time?

2016-11-10 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: Function Proposal: std.algorithm.iteration : cumulativeSum

2016-11-01 Thread Ivan Kazmenko via Digitalmars-d
On Tuesday, 1 November 2016 at 22:13:29 UTC, e-y-e wrote: On Tuesday, 1 November 2016 at 22:09:50 UTC, e-y-e wrote: On Tuesday, 1 November 2016 at 22:06:36 UTC, Ivan Kazmenko wrote: ... damn, that was a typo [cumulativeFold -> cumulativeSum] similarly, in the first para, cumulativeSum!((a,

Re: Function Proposal: std.algorithm.iteration : cumulativeSum

2016-11-01 Thread Ivan Kazmenko via Digitalmars-d
On Tuesday, 1 November 2016 at 21:52:40 UTC, e-y-e wrote: I'd like to propose the function cumulativeFold as a new addition to std.algorithm.iteration. I have already opened a pull request [1] for this addition so the full implementation is available there. The function signatures are: DMD

Re: 16MB static arrays again...

2016-08-24 Thread Ivan Kazmenko via Digitalmars-d
On Wednesday, 24 August 2016 at 07:50:25 UTC, Tomer Filiba wrote: #WEKA #INDUSTRY I found this post from 2007 http://forum.dlang.org/post/fdspch$d3v$1...@digitalmars.com that refers to this post from 2006 http://www.digitalmars.com/d/archives/digitalmars/D/37038.html#N37071 -- and I still

Re: D for competitive programming

2016-07-30 Thread Ivan Kazmenko via Digitalmars-d
Hi! On Thursday, 28 July 2016 at 21:20:29 UTC, urxvt1 wrote: I wanted to try topcoder problems (never used this site before) and I found out that it doesn't support dlang. They only have c++, java, c#, vb.net, python languages. It would be great to see D on this list. I highly doubt TopCoder

Re: add attributes to debug

2016-07-24 Thread Ivan Kazmenko via Digitalmars-d
On Sunday, 24 July 2016 at 21:33:20 UTC, Gorge Jingale wrote: To allow for different debug versions without having to go full blown version(). @mem debug do something memory wise @see debug write a message to console I don't get what would be the benefit. Currently, you can write that like:

Re: Newbie: Error parsing csv file with very long lines

2016-04-23 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: Ada-Style Modulo Integer Types

2016-04-22 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: Compiling with -profile=gc makes program crash - why?

2016-04-21 Thread Ivan Kazmenko via Digitalmars-d
On Thursday, 21 April 2016 at 10:57:12 UTC, Ivan Kazmenko wrote: Humm, when I searched whether it should work, I only found a reassuring post by Walter[1] almost a year ago. The issue tracker does not seem to contain an entry either. Perhaps I should create one, then. [1]

Re: Compiling with -profile=gc makes program crash - why?

2016-04-21 Thread Ivan Kazmenko via Digitalmars-d
On Thursday, 21 April 2016 at 09:23:26 UTC, tcak wrote: I'm trying to use DMD option "-profile=gc". You are using "spawn". So it is a multithreaded program. -profile=gc doesn't work with multithreadd programs. Always creates problems. Humm, when I searched whether it should work, I only

Re: Compiling with -profile=gc makes program crash - why?

2016-04-20 Thread Ivan Kazmenko via Digitalmars-d
On Wednesday, 20 April 2016 at 22:27:36 UTC, Ivan Kazmenko wrote: I'm trying to use DMD option "-profile=gc". With this option, the following simple program crashes with 2.071.0 down to 2.069.0 but still works on 2.068.2. The command line is "dmd -g -profile=gc prfail1.d" on Windows

Compiling with -profile=gc makes program crash - why?

2016-04-20 Thread Ivan Kazmenko via Digitalmars-d
I'm trying to use DMD option "-profile=gc". With this option, the following simple program crashes with 2.071.0 down to 2.069.0 but still works on 2.068.2. The command line is "dmd -g -profile=gc prfail1.d" on Windows (compiled to 32-bit by default). -prfail1.d- import

Mention GSoC on the front page?

2016-04-14 Thread Ivan Kazmenko via Digitalmars-d
Hi, I just navigated to https://gentoo.org (home of Gentoo Linux), and among the scarce news items on the front page, the topmost is about Gentoo and Google Summer of Code. It links to two detailed pages on how and why to get involved. The thought is: maybe GSoC deserves a place on the

Re: 111

2016-02-21 Thread Ivan Kazmenko via Digitalmars-d-learn
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

Re: 111

2016-02-20 Thread Ivan Kazmenko via Digitalmars-d-learn
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);

Re: 111

2016-02-19 Thread Ivan Kazmenko via Digitalmars-d-learn
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?

Re: Idempotent partition around median of 5?

2016-02-05 Thread Ivan Kazmenko via Digitalmars-d
On Saturday, 6 February 2016 at 00:59:17 UTC, Andrei Alexandrescu wrote: On 02/05/2016 06:36 AM, Ivan Kazmenko wrote: Another interesting task would be to make the function stable, but I don't see how it is possible with such flat structure. Under what circumstances isn't your function

Re: Idempotent partition around median of 5?

2016-02-05 Thread Ivan Kazmenko via Digitalmars-d
On Saturday, 6 February 2016 at 07:06:27 UTC, Ivan Kazmenko wrote: On Saturday, 6 February 2016 at 00:59:17 UTC, Andrei Alexandrescu wrote: On 02/05/2016 06:36 AM, Ivan Kazmenko wrote: Another interesting task would be to make the function stable, but I don't see how it is possible with such

Re: Idempotent partition around median of 5?

2016-02-05 Thread Ivan Kazmenko via Digitalmars-d
On Thursday, 4 February 2016 at 01:24:15 UTC, Andrei Alexandrescu wrote: So there's got to be a better solution. Your challenge - should you choose to accept it :o) - is an algorithm that does the partitioning in 6 comparisons and <= 9 swaps, which is idempotent: when applied twice, it always

  1   2   3   >