string version of array

2017-11-13 Thread Tony via Digitalmars-d-learn
Is there an easy way to get the string representation of an array, as would be printed by writeln(), but captured in a string?

Re: ESR on post-C landscape

2017-11-13 Thread lobo via Digitalmars-d-learn
On Tuesday, 14 November 2017 at 04:31:43 UTC, Laeeth Isharc wrote: He mentions D, a bit dismissively. http://esr.ibiblio.org/?p=7724=1#comment-1912717 "[snip]...Then came the day we discovered that a person we incautiously gave commit privileges to had fucked up the games’s AI core. It

ESR on post-C landscape

2017-11-13 Thread Laeeth Isharc via Digitalmars-d-learn
He mentions D, a bit dismissively. http://esr.ibiblio.org/?p=7724=1#comment-1912717

Re: BinaryHeap as member

2017-11-13 Thread Era Scarecrow via Digitalmars-d-learn
On Monday, 13 November 2017 at 16:26:20 UTC, balddenimhero wrote: In the course of writing a minimal example I removed more than necessary in the previous pastebin (the passed IntOrder has not even been used). Thus here is the corrected one: https://pastebin.com/SKae08GT. I'm trying to port

Re: Cannot reduce an empty iterable w/o an explicit seed value

2017-11-13 Thread Vino via Digitalmars-d-learn
On Thursday, 9 November 2017 at 13:24:45 UTC, Nicholas Wilson wrote: On Thursday, 9 November 2017 at 12:40:49 UTC, Vino wrote: [...] The problem is subdirTotalGB = ((reduce!((a,b) => a + b)(SdFiles)) / 1024 / 1024 / 1024); with reduce you need to give it a seed (an initial value to start

Re: How do you open a second console? I have multiple streams of info I want printed.

2017-11-13 Thread Enjoys Math via Digitalmars-d-learn
On Monday, 13 November 2017 at 20:24:38 UTC, Jonathan M Davis wrote: On Monday, November 13, 2017 19:58:51 Enjoys Math via Digitalmars-d-learn wrote: Hi, I tried googling and didn't find anything. I have thread doing a time-intensive search and I want its results printed to a second console

Re: Inline assembly question

2017-11-13 Thread Dibyendu Majumdar via Digitalmars-d-learn
On Monday, 13 November 2017 at 18:40:42 UTC, Basile B. wrote: TBH I wonder if this is not worth a enhancement (or even a DIP) to have in asm blocks a special alias syntax... { asm { version(...) { alias First = RDI; alias Second = RSI;

Re: Inline assembly question

2017-11-13 Thread Dibyendu Majumdar via Digitalmars-d-learn
On Sunday, 12 November 2017 at 22:40:06 UTC, Dibyendu Majumdar wrote: On Sunday, 12 November 2017 at 22:00:58 UTC, Basile B. wrote: no in naked mode you have to save and restore by hand. So how does one manually generate the .pdata and .xdata sections? Are you saying that this is what I

Re: Inline assembly question

2017-11-13 Thread Guillaume Piolat via Digitalmars-d-learn
On Sunday, 12 November 2017 at 22:20:46 UTC, Dibyendu Majumdar no in naked mode you have to save and restore by hand. Note that in Win64 even if not naked, you'll have to save/restore some registers like XMMx with x >= 6. Another question - how can I tell DMD to no generate the frame

Re: How do you open a second console? I have multiple streams of info I want printed.

2017-11-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, November 13, 2017 19:58:51 Enjoys Math via Digitalmars-d-learn wrote: > Hi, > > I tried googling and didn't find anything. > > I have thread doing a time-intensive search and I want its > results printed to a second console while the main console > displays what I already have writing.

Re: Inline assembly question

2017-11-13 Thread Guillaume Piolat via Digitalmars-d-learn
On Monday, 13 November 2017 at 18:40:42 UTC, Basile B. wrote: TBH I wonder if this is not worth a enhancement (or even a DIP) to have in asm blocks a special alias syntax... { asm { version(...) { alias First = RDI; alias Second = RSI; //

How do you open a second console? I have multiple streams of info I want printed.

2017-11-13 Thread Enjoys Math via Digitalmars-d-learn
Hi, I tried googling and didn't find anything. I have thread doing a time-intensive search and I want its results printed to a second console while the main console displays what I already have writing. Thanks.

Re: ddox empty public methods/interfaces etc

2017-11-13 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 10 November 2017 at 10:12:32 UTC, RazvanN wrote: I don't want to open a new forum thread for this, but if you guys have more experience with ddox can you please explain me how does it work? I expected you can simply run ddox on a .d file and it will output the documentation in some

Re: Inline assembly question

2017-11-13 Thread Basile B. via Digitalmars-d-learn
On Monday, 13 November 2017 at 18:40:42 UTC, Basile B. wrote: On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar wrote: [...] TBH I wonder if this is not worth a enhancement (or even a DIP) to have in asm blocks a special alias syntax... { asm { version(...)

Re: Inline assembly question

2017-11-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar wrote: Hi, I have recently started work on building a VM for Lua (actually a derivative of Lua) in X86-64 assembly. I am using the dynasm tool that is part of LuaJIT. I was wondering whether I could also write this in D's inline

Re: BinaryHeap as member

2017-11-13 Thread balddenimhero via Digitalmars-d-learn
On Monday, 13 November 2017 at 15:43:35 UTC, balddenimhero wrote: On Monday, 13 November 2017 at 14:38:35 UTC, balddenimhero wrote: I need a priority queue of integers whose elements are not ordered by the default `opCmp` but some delegate. The following gist illustrates the problem I'm

Re: BinaryHeap as member

2017-11-13 Thread balddenimhero via Digitalmars-d-learn
On Monday, 13 November 2017 at 14:38:35 UTC, balddenimhero wrote: I need a priority queue of integers whose elements are not ordered by the default `opCmp` but some delegate. The following gist illustrates the problem I'm having:

Re: ddox empty public methods/interfaces etc

2017-11-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 10 November 2017 at 10:12:32 UTC, RazvanN wrote: I don't want to open a new forum thread for this, but if you guys have more experience with ddox can you please explain me how does it work? There's two modes of operation for ddox: using dmd -D -X to generate a json file, then

Re: ddox empty public methods/interfaces etc

2017-11-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/10/17 5:12 AM, RazvanN wrote: On Thursday, 9 November 2017 at 14:21:52 UTC, Steven Schveighoffer wrote: On 11/8/17 10:45 PM, Andrey wrote: I just added to dub.json this: "-ddoxFilterArgs": [     "--min-protection=Public" ] i.e. without --only-documented option, in this way ddox will

Re: opCast'ing strings

2017-11-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, November 13, 2017 12:40:39 bauss via Digitalmars-d-learn wrote: > On Monday, 13 November 2017 at 01:12:59 UTC, Adam D. Ruppe wrote: > > On Monday, 13 November 2017 at 01:03:17 UTC, helxi wrote: > >> In this program, casting using to does not work as intended > >> (returning 23/11) on

BinaryHeap as member

2017-11-13 Thread balddenimhero via Digitalmars-d-learn
I need a priority queue of integers whose elements are not ordered by the default `opCmp` but some delegate. The following gist illustrates the problem I'm having: https://run.dlang.io/gist/92876b2c4d8c77cdc68f1ca61e7e8e44?compiler=dmd The `Foo` class is supposed to wrap a binary heap (to be

Re: minElement on array of const objects

2017-11-13 Thread vit via Digitalmars-d-learn
On Monday, 13 November 2017 at 12:15:26 UTC, Nathan S. wrote: Unqual!Element seed = r.front; alias MapType = Unqual!(typeof(mapFun(CommonElement.init))); This looks like a job for std.typecons.Rebindable!(const A) instead of Unqual!(const A) which is used currently. I am surprised that

Re: opCast'ing strings

2017-11-13 Thread bauss via Digitalmars-d-learn
On Monday, 13 November 2017 at 01:12:59 UTC, Adam D. Ruppe wrote: On Monday, 13 November 2017 at 01:03:17 UTC, helxi wrote: In this program, casting using to does not work as intended (returning 23/11) on the struct. However, calling opCast directly seems to do the job. Why is that?

Re: How do I create a fileWatcher with an onFileChange event using spawn?

2017-11-13 Thread bauss via Digitalmars-d-learn
On Monday, 28 August 2017 at 11:25:03 UTC, Jacob Carlborg wrote: On 2017-08-28 08:31, Nemanja Boric wrote: On Monday, 28 August 2017 at 06:27:20 UTC, Jacob Carlborg wrote: http://code.dlang.org/packages/vibe-core http://code.dlang.org/packages/libasync In addition, to avoid polling, it's

Re: minElement on array of const objects

2017-11-13 Thread Nathan S. via Digitalmars-d-learn
Unqual!Element seed = r.front; alias MapType = Unqual!(typeof(mapFun(CommonElement.init))); This looks like a job for std.typecons.Rebindable!(const A) instead of Unqual!(const A) which is used currently. I am surprised that this is the first time anyone has run into this.

Re: minElement on array of const objects

2017-11-13 Thread Temtaime via Digitalmars-d-learn
On Monday, 13 November 2017 at 10:20:51 UTC, Aurelien Fredouelle wrote: Hi all, It seems that it is not possible to use minElement on an array of const objects: class A { int val; } const(A) doStuff(const(A)[] v) { import std.algorithm.searching : minElement; return

minElement on array of const objects

2017-11-13 Thread Aurelien Fredouelle via Digitalmars-d-learn
Hi all, It seems that it is not possible to use minElement on an array of const objects: class A { int val; } const(A) doStuff(const(A)[] v) { import std.algorithm.searching : minElement; return v.minElement!"a.val"; } This gets the following compiler error:

Re: core file

2017-11-13 Thread Antonio Corbi via Digitalmars-d-learn
On Monday, 13 November 2017 at 09:49:29 UTC, codephantom wrote: On Monday, 13 November 2017 at 06:25:20 UTC, Tony wrote: I am on Ubuntu 16.04. Thanks, I didn't know that "producing a core file" was configurable, and it appears that it isn't. ok. that's because Ubuntu is not (by default) setup

Re: core file

2017-11-13 Thread codephantom via Digitalmars-d-learn
On Monday, 13 November 2017 at 06:25:20 UTC, Tony wrote: I am on Ubuntu 16.04. Thanks, I didn't know that "producing a core file" was configurable, and it appears that it isn't. ok. that's because Ubuntu is not (by default) setup for developers. But you can enable core dump for your

Re: core file

2017-11-13 Thread Tony via Digitalmars-d-learn
On Monday, 13 November 2017 at 07:38:14 UTC, Ali Çehreli wrote: It is. If you search for "where is core file ubuntu" you will hit the output of 'man core', as well as answers like the following, which explains that the file may be under /var/cache/abrt:

Re: core file

2017-11-13 Thread Tony via Digitalmars-d-learn
On Monday, 13 November 2017 at 07:38:14 UTC, Ali Çehreli wrote: On 11/12/2017 10:25 PM, Tony wrote: >>> "Segmentation fault (core dumped)" I've been assuming that if it says "dumped", the core is dumped. > I am on Ubuntu 16.04. Thanks, I didn't know that "producing a core file" > was