I didn't want to necropost, but I ran into the same behaviour as
in this post:
https://forum.dlang.org/post/yfybveovbknvvxmio...@forum.dlang.org
and was just curious to understand it better.
If I call readln() after having previously called readf(), it
does not behave as expected:
```d
import
Hi I am working through Programming in D. In one exercise I have
a helper function in a struct
```D
struct Fraction {
auto n = 0L;
auto d = 1L;
// ... other bits ...
ref Fraction reduce() {
import std.numeric : gcd;
v = gcd(n, d);
if (v > 1) {
n /= v;
On Thursday, 13 May 2021 at 19:48:44 UTC, Ali Çehreli wrote:
I was writing this example that shows a use case for the
problem (marked with BUG below):
```D
struct Fraction {
auto n = 0L;
auto d = 1L;
// ... other bits ...
ref Fraction reduce() {
import std.numeric : gcd;
In the solution to one of the exercises in Programming in D the
unittests fail with respect to the toHash implementation.
Here is a link to the full solution provided:
https://run.dlang.io/gist/99ddf791f86aaa9d333d032166aadcb9?args=-unittest%20-main
and the link to the relevant section in the b