On Wednesday, 7 July 2021 at 01:44:20 UTC, Steven Schveighoffer
wrote:
This is pretty minimal, but does what I want it to do. Is it
ready for inclusion in Phobos? Not by a longshot! A truly
generic interleave would properly forward everything else that
the range supports (like `length`, `save`,
On Thursday, 1 April 2021 at 19:55:05 UTC, H. S. Teoh wrote:
On Thu, Apr 01, 2021 at 07:25:53PM +, matheus via
Digitalmars-d-learn wrote: [...]
Since this is a "Learn" part of the Foruam, be careful with
"-boundscheck=off".
I mean for this little snippet is OK, but for a other projects
th
On Tuesday, 23 February 2021 at 00:08:40 UTC, tsbockman wrote:
On Friday, 19 February 2021 at 00:13:19 UTC, Jon Degenhardt
wrote:
It would be interesting to see how the performance compares to
tsv-uniq
(https://github.com/eBay/tsv-utils/tree/master/tsv-uniq). The
prebuilt binaries turn on all
On Wednesday, 17 February 2021 at 04:10:24 UTC, tsbockman wrote:
I spent some time experimenting with this problem, and here is
the best solution I found, assuming that perfect de-duplication
is required. (I'll put the code up on GitHub / dub if anyone
wants to have a look.)
It would be inter
On Friday, 22 January 2021 at 17:29:08 UTC, Steven Schveighoffer
wrote:
On 1/22/21 11:57 AM, Jon Degenhardt wrote:
I think the idea is that if a construct like
'xyz.splitter(args)' produces a range with the sequence of
elements {"a", "bc", "def"}, then 'xyz.splitter(args).back'
should produc
On Friday, 22 January 2021 at 14:14:50 UTC, Steven Schveighoffer
wrote:
On 1/22/21 12:55 AM, Jon Degenhardt wrote:
On Friday, 22 January 2021 at 05:51:38 UTC, Jon Degenhardt
wrote:
On Thursday, 21 January 2021 at 22:43:37 UTC, Steven
Schveighoffer wrote:
auto sp1 = "a|b|c".splitter('|');
writ
On Friday, 22 January 2021 at 05:51:38 UTC, Jon Degenhardt wrote:
On Thursday, 21 January 2021 at 22:43:37 UTC, Steven
Schveighoffer wrote:
auto sp1 = "a|b|c".splitter('|');
writeln(sp1.back); // ok
auto sp2 = "a.b|c".splitter!(v => !isAlphaNum(v));
writeln(sp2.back); // error, not bidirectio
On Thursday, 21 January 2021 at 22:43:37 UTC, Steven
Schveighoffer wrote:
auto sp1 = "a|b|c".splitter('|');
writeln(sp1.back); // ok
auto sp2 = "a.b|c".splitter!(v => !isAlphaNum(v));
writeln(sp2.back); // error, not bidirectional
Why? is it an oversight, or is there a good reason for it?
-S
On Tuesday, 15 September 2020 at 14:59:03 UTC, Steven
Schveighoffer wrote:
On 9/15/20 10:18 AM, James Blachly wrote:
What will it take (i.e. order of difficulty) to get this fixed
-- will merely a bug report (and PR, not sure if I can tackle
or not) do it, or will this require more in-depth dis
On Tuesday, 15 September 2020 at 02:23:31 UTC, Paul Backus wrote:
On Tuesday, 15 September 2020 at 01:49:13 UTC, James Blachly
wrote:
I wish to write a function including ∂x and ∂y (these are
trivial to type with appropriate keyboard shortcuts - alt+d on
Mac), but without a unicode byte order m
On Friday, 4 September 2020 at 07:27:33 UTC, glis-glis wrote:
On Thursday, 3 September 2020 at 14:34:48 UTC, Jacob Carlborg
wrote:
Oh, multiple binaries, I missed that. You can try to add
multiple configurations [1]. Or if you have executables
depending on only one source file, you can use sing
On Tuesday, 25 August 2020 at 15:02:14 UTC, FreeSlave wrote:
On Tuesday, 25 August 2020 at 03:41:06 UTC, Jon Degenhardt
wrote:
What's the best way to get the element type of an array at
compile time?
Something like std.range.ElementType except that works on any
array type. There is std.traits
On Tuesday, 25 August 2020 at 12:50:35 UTC, Steven Schveighoffer
wrote:
The situation is still confusing though. If only
'std.range.ElementType' is imported, a static array does not
have a 'front' member, but ElementType still gets the correct
type. (This is where the documentation says it'll r
On Tuesday, 25 August 2020 at 05:02:46 UTC, Basile B. wrote:
On Tuesday, 25 August 2020 at 03:41:06 UTC, Jon Degenhardt
wrote:
What's the best way to get the element type of an array at
compile time?
Something like std.range.ElementType except that works on any
array type. There is std.traits
On Tuesday, 25 August 2020 at 04:36:56 UTC, H. S. Teoh wrote:
[...]
Harry Gillanders, H.S. Teoh,
Thank you both for the quick replies. Both methods address my
needs. Very much appreciated, I was having trouble figuring this
one out.
--Jon
What's the best way to get the element type of an array at
compile time?
Something like std.range.ElementType except that works on any
array type. There is std.traits.ForeachType, but it wasn't clear
if that was the right thing.
--Jon
On Saturday, 15 August 2020 at 04:09:19 UTC, James Gray wrote:
I am trying to use getopt and would not like the program to
throw an unhandled exception when parsing command line options.
Is the following, adapted from the first example in the getopt
documentation, a reasonable approach?
I use
On Thursday, 13 August 2020 at 14:41:02 UTC, Steven Schveighoffer
wrote:
But for sure, reading from stdin doesn't do anything different
than reading from a file if you are using the File struct.
A more appropriate test might be using the shell to feed the
file into the D program:
dprogram <
On Wednesday, 12 August 2020 at 22:44:44 UTC, methonash wrote:
Hi,
Relative beginner to D-lang here, and I'm very confused by the
apparent performance disparity I've noticed between programs
that do the following:
1) cat some-large-file | D-program-reading-stdin-byLine()
2) D-program-direct
On Thursday, 16 July 2020 at 17:40:25 UTC, Steven Schveighoffer
wrote:
On 7/16/20 1:13 PM, Andre Pany wrote:
On Thursday, 16 July 2020 at 05:03:36 UTC, Jon Degenhardt
wrote:
On Wednesday, 15 July 2020 at 07:12:35 UTC, Andre Pany wrote:
[...]
An enhancement is likely to hit some corner-cases
On Wednesday, 15 July 2020 at 07:12:35 UTC, Andre Pany wrote:
On Tuesday, 14 July 2020 at 15:48:59 UTC, Andre Pany wrote:
On Tuesday, 14 July 2020 at 14:33:47 UTC, Steven Schveighoffer
wrote:
On 7/14/20 10:22 AM, Steven Schveighoffer wrote:
The documentation needs updating, it should say "param
On Friday, 12 June 2020 at 06:20:59 UTC, H. S. Teoh wrote:
I glanced over the implementation of byLine. It appears to be
the unhappy compromise of trying to be 100% correct, cover all
possible UTF encodings, and all possible types of input streams
(on-disk file vs. interactive console). It do
On Friday, 12 June 2020 at 00:58:34 UTC, duck_tape wrote:
On Thursday, 11 June 2020 at 23:45:31 UTC, H. S. Teoh wrote:
Hmm, looks like it's not so much input that's slow, but
*output*. In fact, it looks pretty bad, taking almost as much
time as overlap() does in total!
[snip...]
I'll play
On Monday, 27 April 2020 at 05:06:21 UTC, anon wrote:
To implement your option A you could simply use
std.range.enumerate.
Would something like this work?
import std.algorithm.iteration : map;
import std.algorithm.searching : until;
import std.range : tee;
size_t bytesConsumed;
auto result =
On Monday, 27 April 2020 at 04:51:54 UTC, Steven Schveighoffer
wrote:
On 4/26/20 11:38 PM, Jon Degenhardt wrote:
Is there a better way to write this?
I had exactly the same problems. I created this to solve the
problem, I've barely tested it, but I plan to use it with all
my parsing utilitie
On Monday, 27 April 2020 at 04:41:58 UTC, drug wrote:
27.04.2020 06:38, Jon Degenhardt пишет:
Is there a better way to write this?
--Jon
I don't know a better way, I think you enlist all possible ways
- get a value using either `front` or special range member. I
prefer the second variant,
I have a string that contains a sequence of elements, then a
terminator character, followed by a different sequence of
elements (of a different type).
I want to create an input range that traverses the initial
sequence. This is easy enough. But after the initial sequence has
been traversed, t
On Friday, 17 April 2020 at 16:56:57 UTC, Russel Winder wrote:
Hi,
Thinking of trying to do the next project in D rather than
Rust, but…
Rust has built in unit testing on a module basis. D has this so
no problem.
Rust allows for integration tests in the tests directory of a
project. These
On Tuesday, 14 April 2020 at 20:25:08 UTC, p.shkadzko wrote:
On Tuesday, 14 April 2020 at 20:05:28 UTC, Steven Schveighoffer
wrote:
On 4/14/20 3:34 PM, p.shkadzko wrote:
[...]
What about using dependency tsv-utils:common ?
Looks like tsv-utils is a collection of subpackages, and the
main p
On Friday, 15 November 2019 at 03:51:04 UTC, Joel wrote:
I made a feature that converts, say, [9:59am] -> [10:00am] to 1
minute. but found '9'.to!int = 57 (not 9).
Doesn't seem right... I'm guessing that's standard though, same
with ldc.
Use a string or char[] array. e.g. writeln("9".to!int)
On Thursday, 14 November 2019 at 12:25:30 UTC, Robert M. Münch
wrote:
Just trying a very simple thing and it's pretty hard: "Read a
CSV file (raw_data) that has a ; separator so that I can
iterate over the lines and access the fields."
csv_data = raw_data.byLine.joiner("\n")
From the
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 neat packaging into one line using the attribute on
the type.
Unfortunately, the version of gdc that comes with the version
of debian
that i am using does not ha
On Wednesday, 9 October 2019 at 05:46:12 UTC, berni44 wrote:
On Tuesday, 8 October 2019 at 20:37:03 UTC, dan wrote:
But i would like to be able to do this without knowing the
expansion of pi, or writing too much code, especially if
there's some d function like writeAllDigits or something
simil
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote:
Should I go for C and then when I become a better programmer
change to D?
Should I start with D right now?
In my view, the most important thing is the decision you've
already made - to pick a programming language and learn it in a
On Saturday, 25 May 2019 at 22:18:16 UTC, Andre Pany wrote:
On Saturday, 25 May 2019 at 08:32:08 UTC, BoQsc wrote:
I have a simple standard .d script and I'm getting annoyed
that it takes 2-3 seconds to run and see the results via rdmd.
Also please keep in mind there could be other factors lik
On Thursday, 4 April 2019 at 10:31:43 UTC, Julian wrote:
On Thursday, 4 April 2019 at 09:57:26 UTC, rikki cattermole
wrote:
If you need performance use ldc not dmd (assumed).
LLVM has many factors better code optimizes than dmd does.
Thanks! I already had dmd installed from a brief look at D
In Dub, is there a way to specify the equivalent of the
--combined command line argument in the json/sdl package config
file?
What I'd like to be able to do is create a custom build type such
that
$ dub build --build=build-xyz
builds in combined mode, without needing to add the --combin
On Monday, 22 October 2018 at 18:44:01 UTC, Jacob Carlborg wrote:
On 2018-10-21 20:45, Jon Degenhardt wrote:
The issue that caused me to go to Ubuntu 16.04 had to do with
uncaught exceptions when using LTO with the gold linker and
LDC 1.5. Problem occurred with 14.04, but not 16.04. I should
On Saturday, 3 November 2018 at 14:26:02 UTC, dwdv wrote:
Hi there,
the task is simple: count word occurrences from stdin (around
150mb in this case) and print sorted results to stdout in a
somewhat idiomatic fashion.
Now, d is quite elegant while maintaining high performance
compared to bo
On Sunday, 21 October 2018 at 18:11:37 UTC, Jacob Carlborg wrote:
On 2018-10-18 01:15, Jon Degenhardt wrote:
I need to use docker to build static linked Linux executables.
My reason
is specific, may be different than the OP's. I'm using
Travis-CI to
build executables. Travis-CI uses Ubuntu 14.
On Friday, 19 October 2018 at 22:16:04 UTC, Ky-Anh Huynh wrote:
On Wednesday, 17 October 2018 at 23:15:53 UTC, Jon Degenhardt
wrote:
I need to use docker to build static linked Linux executables.
My reason is specific, may be different than the OP's. I'm
using Travis-CI to build executables.
On Wednesday, 17 October 2018 at 08:08:44 UTC, Gary Willoughby
wrote:
On Wednesday, 17 October 2018 at 03:37:21 UTC, Ky-Anh Huynh
wrote:
Hi,
I need to build some static binaries with LDC. I also need to
execute builds on both platform 32-bit and 64-bit.
From Docker Hub there are two image g
On Friday, 5 October 2018 at 16:34:32 UTC, Paul Backus wrote:
On Friday, 5 October 2018 at 06:56:49 UTC, Nicholas Wilson
wrote:
On Friday, 5 October 2018 at 06:44:08 UTC, Nicholas Wilson
wrote:
Alas is does not because each does not accept additional
argument other than the range. Shouldn't be
On Friday, 5 October 2018 at 06:44:08 UTC, Nicholas Wilson wrote:
On Friday, 5 October 2018 at 06:22:57 UTC, Nicholas Wilson
wrote:
tenRandomNumbers.each!((n,o) =>
o.appendln(n.to!string))(output);
or
tenRandomNumbers.each!((n, ref o) =>
o.appendln(n.to!string))(output);
should hopefully d
I got the compilation error in the subject line when trying to
create a range via std.range.generate. Turns out this was caused
by trying to create a closure for 'generate' where the closure
was accessing a struct containing a destructor.
The fix was easy enough: write out the loop by hand rat
On Tuesday, 28 August 2018 at 06:20:37 UTC, Sebastiaan Koppe
wrote:
On Tuesday, 28 August 2018 at 06:11:35 UTC, Jon Degenhardt
wrote:
The goal is to write the argument list once and use it to
create both the function and the Tuple alias. That way I could
create a large number of these function
I'd like to create a Tuple alias representing a function's
parameter list. Is there a way to do this?
Here's an example creating a Tuple alias for a function's
parameters by hand:
import std.typecons: Tuple;
bool fn(string op, int v1, int v2)
{
switch (op)
{
On Monday, 21 May 2018 at 15:00:09 UTC, Dennis wrote:
I want to be convinced that Range programming works like a
charm, but the procedural approaches remain more flexible (and
faster too) it seems. Thanks for the example.
On Monday, 21 May 2018 at 22:11:42 UTC, Dennis wrote:
In this case I us
On Thursday, 17 May 2018 at 20:08:09 UTC, Dennis wrote:
On Wednesday, 16 May 2018 at 15:47:29 UTC, Jon Degenhardt wrote:
If you write it in the style of my earlier example and use
counters and if-tests it will work. byLine by itself won't try
to interpret the characters (won't auto-decode them)
On Wednesday, 16 May 2018 at 07:06:45 UTC, Dennis wrote:
On Wednesday, 16 May 2018 at 02:47:50 UTC, Jon Degenhardt wrote:
Can you show the program you are using that throws when using
byLine?
Here's a version that only outputs the first chunk:
```
import std.stdio;
import std.range;
import std
On Tuesday, 15 May 2018 at 20:36:21 UTC, Dennis wrote:
I have a file with two problems:
- It's too big to fit in memory (apparently, I thought 1.5 Gb
would fit but I get an out of memory error when using
std.file.read)
- It is dirty (contains invalid Unicode characters, null bytes
in the middl
On Monday, 11 December 2017 at 20:58:25 UTC, Jordi Gutiérrez
Hermoso wrote:
What's the proper style, then? Can someone show me a good
example of how to use getopt and the docstring it automatically
generates?
The command line tools I published use the approach described in
a number of the rep
On Saturday, 30 September 2017 at 17:17:17 UTC, SrMordred wrote:
writeln( "a.b.c".splitter('.').dropBack(1) ); //compiles ok
writeln( "a.b.c".splitter(".").dropBack(1) );
//error:
Error: template std.range.dropBack cannot deduce function from
argument types !()(Result, int), candidates are:
(.
On Saturday, 30 September 2017 at 19:26:14 UTC, SrMordred wrote:
For "a.b.c"splitter(x), Range r is a string, r.front is a
char. The template can only be instantiated if the predicate
function is valid. The predicate function is "a == b". Since
r.front is a char, then s must be a type that can
On Saturday, 30 September 2017 at 17:17:17 UTC, SrMordred wrote:
writeln( "a.b.c".splitter('.').dropBack(1) ); //compiles ok
writeln( "a.b.c".splitter(".").dropBack(1) );
//error:
Error: template std.range.dropBack cannot deduce function from
argument types !()(Result, int), candidates are:
(.
On Saturday, 30 September 2017 at 07:41:21 UTC, Igor wrote:
On Friday, 29 September 2017 at 22:13:01 UTC, Jon Degenhardt
wrote:
Have there been any investigations into using region-based
memory management (aka memory arenas) in D, possibly in
conjunction with GC allocated memory?
Sounds like
Have there been any investigations into using region-based memory
management (aka memory arenas) in D, possibly in conjunction with
GC allocated memory? This would be a very speculative idea, but
it'd be interesting to know if there have been looks at this area.
My own interest is request-resp
On Tuesday, 5 September 2017 at 11:36:06 UTC, Sönke Ludwig wrote:
Am 24.01.2017 um 17:02 schrieb Las:
How do I enable LTO in DUB in a sane way?
I could add it to dflags, but I only want it on release builds.
You can put a "buildTypes" section in your package recipe and
override default dflag
On Friday, 1 September 2017 at 19:04:39 UTC, Daniel Kozak wrote:
I have same issue. How this help you? Catching exception does
not help. How do I catch exception and still print help message?
Your are correct, sorry about that. What my response showed is
how to avoid printing the full stack
On Friday, 1 September 2017 at 13:13:39 UTC, Vino.B wrote:
Hi All,
When i run the below program without any arguments "D1.d -r"
it is throwing error, but i need it to show the help menu
[snip...]
Hi Vino,
To get good error message behavior you need to put the construct
in a try-catch bl
On Tuesday, 29 August 2017 at 00:52:11 UTC, Cecil Ward wrote:
I am vacillating - considering breaking a lifetime's C habits
and letting the D garbage collector make life wonderful by just
cleaning up after me and ruining my future C disciple by not
deleting stuff myself.
The tsv command line
On Monday, 21 August 2017 at 05:58:01 UTC, Jonathan M Davis wrote:
On Monday, August 21, 2017 02:34:23 Mike Parker via
Digitalmars-d-learn wrote:
On Sunday, 20 August 2017 at 18:08:27 UTC, Jon Degenhardt
wrote:
> Documentation for std.range.put
> (https://dlang.org/phobos/std_range_primitives.h
Documentation for std.range.put
(https://dlang.org/phobos/std_range_primitives.html#.put) has the
intriguing line:
put should not be used "UFCS-style", e.g. r.put(e). Doing this
may call R.put directly, by-passing any transformation feature
provided by Range.put. put(r, e) is prefered.
This
On Wednesday, 9 August 2017 at 13:36:46 UTC, Steven Schveighoffer
wrote:
On 8/8/17 3:43 PM, Anonymouse wrote:
On Tuesday, 8 August 2017 at 16:00:17 UTC, Steven
Schveighoffer wrote:
I wouldn't use formattedRead, as I think this is going to
allocate temporaries for a and b.
What would you sugge
On Sunday, 16 July 2017 at 17:03:27 UTC, unDEFER wrote:
[snip]
How to write in D grep not slower than GNU grep?
GNU grep is pretty fast, it's tough to beat it reading one line
at a time. That's because it can play a bit of a trick and do the
initial match ignoring line boundaries and correct
On Friday, 19 May 2017 at 12:09:38 UTC, Suliman wrote:
I would like to check if user specified `0` as getopt
parameter. But the problem that `int`'s are default in `0`. So
if user did not specified nothing `int x` will be zero, and all
other code will work as if it's zero.
One way to do this
On Wednesday, 10 May 2017 at 22:20:52 UTC, Nordlöw wrote:
What's fastest way to on-the-fly-decompress and process a
gzipped csv-fil line by line?
Is it possible to combine
http://dlang.org/phobos/std_zlib.html
with some stream variant of
File(path).byLineFast
?
I was curious what byLineFa
On Wednesday, 12 April 2017 at 09:51:34 UTC, Russel Winder wrote:
Are Argon https://github.com/markuslaker/Argon or darg
https://github. com/jasonwhite/darg getting traction as the
default command line handling system for D or are they just
peripheral and everyone just uses std.getopt
https:/
On Tuesday, 11 April 2017 at 20:00:48 UTC, Jethro wrote:
On Tuesday, 11 April 2017 at 03:00:29 UTC, Jon Degenhardt wrote:
On Tuesday, 11 April 2017 at 01:59:57 UTC, Jonathan M Davis
wrote:
On Tuesday, April 11, 2017 01:42:32 Jethro via
Digitalmars-d-learn wrote:
[...]
You can't reuse the mem
On Tuesday, 11 April 2017 at 01:59:57 UTC, Jonathan M Davis wrote:
On Tuesday, April 11, 2017 01:42:32 Jethro via
Digitalmars-d-learn wrote:
arrays have the ability to reserve but when setting the length
to 0, it removes the reserve!! ;/
char[] buf;
buf.reserve = 1000;
buf.length = 0;
assert(b
On Friday, 31 March 2017 at 04:41:10 UTC, Joel wrote:
Linking...
ld: warning: pointer not aligned at address 0x10017A4C9
(_D30TypeInfo_AxS3std4file8DirEntry6__initZ + 16 from
.dub/build/application-debug-posix.osx-x86_64-dmd_2072-EFDCDF4D45F944F7A9B1AEA5C32F81ED/spellit.o)
...
and this goes o
On Monday, 23 January 2017 at 22:20:59 UTC, Ali Çehreli wrote:
On 01/23/2017 12:48 PM, Jon Degenhardt wrote:
[snip]
> So, what I'm really wondering is if there is built-in way
to get closer to:
outputStream.writefln(...);
If it's about formatted output then perhaps formattedWrite?
On Monday, 23 January 2017 at 08:03:14 UTC, Ali Çehreli wrote:
On 01/22/2017 01:54 PM, Jon Degenhardt wrote:
I've been increasingly using output ranges in my code (the
"component
programming" model described in several articles on the D
site). It
works very well, except that it would often be m
I've been increasingly using output ranges in my code (the
"component programming" model described in several articles on
the D site). It works very well, except that it would often be
more convenient to use writeln style functions rather than 'put'.
Especially when you start by drafting a sket
On Saturday, 7 January 2017 at 02:41:54 UTC, ketmar wrote:
On Saturday, 7 January 2017 at 02:30:53 UTC, Jon Degenhardt
wrote:
Is there a way to make a compile time check against the
dmd/phobos version number? Functionally, what I'd like to
achieve would be equivalent to:
version(dmdVersio
Is there a way to make a compile time check against the
dmd/phobos version number? Functionally, what I'd like to achieve
would be equivalent to:
version(dmdVersion >= 2.070.1)
{
}
else
{
...
}
I think I've seen something like this, probably using '
On Thursday, 22 December 2016 at 07:33:42 UTC, Ali Çehreli wrote:
On 12/21/2016 07:59 PM, Jon Degenhardt wrote:
> construct the 'opts' parameter from
> definitions stored in two or more files. The reason for doing
this is to
> create a customization mechanism where-by there are a number
of defau
I'd like to find a way to define programming constructs in one
file and reference them in a getopt call defined in another file.
getopt uses variadic template argument, so the argument list must
be known at compile time. The std.getopt.getopt signature:
GetoptResult getopt(T...)(ref strin
On Wednesday, 7 December 2016 at 16:33:03 UTC, bachmeier wrote:
On Wednesday, 7 December 2016 at 12:12:56 UTC, Ilya Yaroshenko
wrote:
R, Matlab, Python, Mathematica, Gauss, and Julia use C libs.
--Ilya
You can call into those same C libs using D. Only if you want a
pure D solution do you ne
On Tuesday, 6 December 2016 at 15:29:59 UTC, Jonathan M Davis
wrote:
On Tuesday, December 06, 2016 13:19:22 Anonymouse via
Digitalmars-d-learn wrote:
On Tuesday, 6 December 2016 at 10:52:44 UTC, thedeemon wrote:
[...]
> 2. Up until 4 KB it reallocates when growing, but after 4 KB
> the array
I've been using Appender quite a bit recently, typically when I
need append-only arrays with variable and unknown final sizes. I
had been prepared to write a custom data structure when I started
using it with large amounts of data, but very nicely this has not
surfaced as a need. Appender has h
On Tuesday, 11 October 2016 at 19:46:31 UTC, Jon Degenhardt wrote:
On Tuesday, 11 October 2016 at 18:18:41 UTC, ag0aep6g wrote:
On 10/11/2016 06:24 AM, Jon Degenhardt wrote:
The example I gave uses ref parameters. On the surface it
would seem
reasonable to that passing a static array by ref wou
On Tuesday, 11 October 2016 at 18:18:41 UTC, ag0aep6g wrote:
On 10/11/2016 06:24 AM, Jon Degenhardt wrote:
The example I gave uses ref parameters. On the surface it
would seem
reasonable to that passing a static array by ref would allow
it to be
modified, without having to slice it first.
Yo
On Monday, 10 October 2016 at 16:46:55 UTC, Jonathan M Davis
wrote:
On Monday, October 10, 2016 16:29:41 TheGag96 via
Digitalmars-d-learn wrote:
On Saturday, 8 October 2016 at 21:14:43 UTC, Jon Degenhardt
wrote:
> This distinction is a bit on the nuanced side. Is it
> behaving as it should?
>
On Thursday, 6 October 2016 at 20:11:17 UTC, ag0aep6g wrote:
On 10/06/2016 09:54 PM, TheGag96 wrote:
Interestingly enough, I found that using .each() actually
compiles
without the []
[...]
why can the compiler consider it a range here but not
.sort()?
each is not restricted to ranges. It ac
On Monday, 19 September 2016 at 18:10:22 UTC, bachmeier wrote:
Suppose I want to iterate over two arrays at once:
foreach(v1, v2; [1.5, 2.5, 3.5], [4.5, 5.5, 6.5]) {
...
}
I have seen a way to do this but cannot remember what it is and
cannot find it.
range.lockstep: https://dlang.org/pho
On Thursday, 8 September 2016 at 08:44:54 UTC, Lodovico Giaretta
wrote:
On Thursday, 8 September 2016 at 08:20:49 UTC, Jon Degenhardt
wrote:
[snip]
I think that
auto x = new Derived!(typeof(stdout.lockingTextWriter()))(); //
note the parenthesis
should work.
But usually, you save the
I've been generalizing output routines by passing an OutputRange
as an argument. This gets interesting when the output routine is
an virtual function. Virtual functions cannot be templates, so
instead the template parameters need to be part of class
definition and specified when instantiating t
On Wednesday, 7 September 2016 at 00:40:27 UTC, Jonathan M Davis
wrote:
On Tuesday, September 06, 2016 21:16:05 Jon Degenhardt via
Digitalmars-d-learn wrote:
On Tuesday, 6 September 2016 at 21:00:53 UTC, Lodovico Giaretta
wrote:
> On Tuesday, 6 September 2016 at 20:46:54 UTC, Jon Degenha
On Tuesday, 6 September 2016 at 21:00:53 UTC, Lodovico Giaretta
wrote:
On Tuesday, 6 September 2016 at 20:46:54 UTC, Jon Degenhardt
wrote:
Is there a way to constrain template arguments to reference or
value types? I'd like to do something like:
T foo(T)(T x)
if (isReferenceType!T)
{ ... }
Is there a way to constrain template arguments to reference or
value types? I'd like to do something like:
T foo(T)(T x)
if (isReferenceType!T)
{ ... }
--Jon
On Saturday, 30 July 2016 at 22:52:23 UTC, bachmeier wrote:
On Saturday, 30 July 2016 at 12:30:55 UTC, LaTeigne wrote:
On Saturday, 30 July 2016 at 12:24:55 UTC, ketmar wrote:
On Saturday, 30 July 2016 at 12:18:08 UTC, LaTeigne wrote:
it you think that you know the things better than somebody
On Wednesday, 25 May 2016 at 19:42:43 UTC, Gary Willoughby wrote:
On Monday, 23 May 2016 at 03:03:12 UTC, Jon Degenhardt wrote:
Currently not possible. Enhancement request perhaps?
Looking at the implementation, setting its 'offset' member
seems to work. Based on example from documentation:
On Sunday, 22 May 2016 at 23:01:07 UTC, Ali Çehreli wrote:
On 05/22/2016 11:59 AM, Jon Degenhardt wrote:
Is there a way to clear an OutBuffer, but without freeing the
internally
managed buffer? Something similar to std.array.appender.clear
method.
Intent would be to reuse the OutBuffer, but wit
Is there a way to clear an OutBuffer, but without freeing the
internally managed buffer? Something similar to
std.array.appender.clear method. Intent would be to reuse the
OutBuffer, but without reallocating memory for the buffer.
--Jon
95 matches
Mail list logo