On Sunday, June 11, 2017 06:28:18 Stanislav Blinov via Digitalmars-d-learn
wrote:
> On Sunday, 11 June 2017 at 05:36:08 UTC, helxi wrote:
> > I was writing a program that reads and prints the first nth
> > lines to the stdout:
> >
> > import std.stdio;
> >
> > void main(string[] args)
> > {
> >
>
On Sunday, 11 June 2017 at 05:36:08 UTC, helxi wrote:
I was writing a program that reads and prints the first nth
lines to the stdout:
import std.stdio;
void main(string[] args)
{
import std.algorithm, std.range;
import std.conv;
stdin.byLine.take(args[1].to!ulong).each!writeln;
}
On Sunday, 11 June 2017 at 08:33:16 UTC, Cym13 wrote:
On Sunday, 11 June 2017 at 05:36:08 UTC, helxi wrote:
[...]
Ok, if I read you right you are writing to stdin and want first
to print the first args[1] lines, then to do other things with
the other lines of stdin.
[...]
Meh... I just n
Is the creation of shared objects still not possible on MacOS with:
1. DMD;
2. LDC2;
3. GDC.
?
--
Russel.
=
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770
On Sunday, 11 June 2017 at 09:53:09 UTC, Russel Winder wrote:
Is the creation of shared objects still not possible on MacOS
with:
1. DMD;
2. LDC2;
3. GDC.
?
DMD:
- possible with runtime disabled, all versions
- or -betterC approach
LDC:
- possible with shared runtime dynlib IIRC sinc
On Sunday, 11 June 2017 at 06:28:18 UTC, Stanislav Blinov wrote:
On Sunday, 11 June 2017 at 05:36:08 UTC, helxi wrote:
I was writing a program that reads and prints the first nth
lines to the stdout:
import std.stdio;
void main(string[] args)
{
import std.algorithm, std.range;
import
On Sunday, 11 June 2017 at 12:44:05 UTC, helxi wrote:
On Sunday, 11 June 2017 at 06:28:18 UTC, Stanislav Blinov wrote:
On Sunday, 11 June 2017 at 05:36:08 UTC, helxi wrote:
[...]
You need only the nth line? Then you'd need to `drop` the
preceding ones:
void main(string[] args) {
import
On Sunday, 11 June 2017 at 12:49:51 UTC, Cym13 wrote:
print each line
byLine doesn't reall all input at once. Using byline and take
you are effectively reading only the right amount of lines and
not reading the rest. You already have what you want, what
makes you think the contrary?
Oh it w
On Sunday, 4 June 2017 at 18:15:36 UTC, Russel Winder wrote:
On Sun, 2017-06-04 at 17:56 +0200, Jacob Carlborg via
Digitalmars-d- learn wrote:
On 2017-06-04 07:44, Jesse Phillips wrote:
> What is your expected behavior? Throw an exception? You can't
> really
> append an absolute path to another
On 06/11/2017 03:00 PM, helxi wrote:
I would also be
really humbled if you demonstrate a faster approach of achieving the
goal of the program :) (without explicitly using loops and conditions)
Do you have a reason to believe that your version is slow? I don't see
why it would be.
On Friday, 9 June 2017 at 17:50:28 UTC, Honey wrote:
Looking at the implementation of Tuple.opCmp, I'm not sure I'd
bet on existence of opCmp for fundamental types:
int opCmp(R)(R rhs)
if (areCompatibleTuples!(typeof(this), R, "<"))
{
foreach (i, Unused; Type
On Sunday, 11 June 2017 at 15:24:30 UTC, Honey wrote:
Doesn't it make sense to introduce another overload of cmp
similar to Steve's doCmp [2] right at that spot?
Moreover, it seems that std.algorithm.cmp should employ three way
comparison as well. The current implementation
int cmp(alias pre
On Sunday, 11 June 2017 at 15:40:42 UTC, Honey wrote:
On Sunday, 11 June 2017 at 15:24:30 UTC, Honey wrote:
Doesn't it make sense to introduce another overload of cmp
similar to Steve's doCmp [2] right at that spot?
Moreover, it seems that std.algorithm.cmp should employ three
way comparison
Just trying to compile a "Hello World" using dub and ldc2. The 32
bit works fine:
generic@generic-ThinkPad-T61:~/Desktop/test$ dub run
--compiler=ldc2 --arch=x86
Performing "debug" build using ldc2 for x86.
test ~master: target for configuration "application" is up to
date.
To force a rebu
On Sunday, 11 June 2017 at 04:08:56 UTC, Seb wrote:
But I'm not sure about doing this.
This is a copy of the __official__ D installer as advertised on
dlang.org (http://dlang.org/download.html):
curl -fsS https://dlang.org/install.sh | bash -s dmd
(the releases are signed)
i.dlang.io is
Is it possible to sum an array in O(1)?
On Monday, 12 June 2017 at 01:02:58 UTC, helxi wrote:
Is it possible to sum an array in O(1)?
No.
If you want to sum the elements you have to at-least look at all
the elements.
So it'll always be O(N).
it's the best you can do.
On Monday, 12 June 2017 at 01:36:04 UTC, Stefan Koch wrote:
On Monday, 12 June 2017 at 01:02:58 UTC, helxi wrote:
Is it possible to sum an array in O(1)?
No.
If you want to sum the elements you have to at-least look at
all the elements.
So it'll always be O(N).
it's the best you can do.
On
On Friday, 9 June 2017 at 19:43:55 UTC, Era Scarecrow wrote:
On Friday, 9 June 2017 at 18:32:06 UTC, Steven Schveighoffer
wrote:
Wow, so that's how D code would look like if it were C++ :)
When dipping my toes into C++ to do a quicksort algorithm, I
quickly got annoyed I'd have to create all
19 matches
Mail list logo