Re: Abstract Classes

2017-12-06 Thread IM via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 23:16:54 UTC, Ali Çehreli wrote: On 12/06/2017 03:01 PM, IM wrote: > On Wednesday, 6 December 2017 at 07:54:21 UTC, Ali Çehreli wrote: >> On 12/05/2017 11:23 PM, IM wrote: >>> [...] >> >> Just remove the override keywords in this case. No function is >>

Re: Seperating class methods in a different module

2017-12-06 Thread Neia Neutuladh via Digitalmars-d-learn
On Thursday, 7 December 2017 at 02:32:03 UTC, helxi wrote: 1. How can I separate class methods from the declaration block? And how can I implement them in a separate module? module a; class Test { import b; mixin TestMethodImpl!(); } module b; template TestMethodImpl() { void foo(); }

Seperating class methods in a different module

2017-12-06 Thread helxi via Digitalmars-d-learn
1. How can I separate class methods from the declaration block? And how can I implement them in a separate module? module frame; class Test { public: int x; this(); } Test.this() { x = 34; } // does not work In this scenario I would like to take the constructor to a

Re: Problem getting Cimgui to work

2017-12-06 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 21:21:11 UTC, Thomas wrote: Hi folks! I got it to work, but honestly I don't know why.. :-) Glad you got it working. I wanted to reply earlier but I was on my phone when I first saw this thread. So now instead of helping you solve the problem, I'll throw in

Re: Abstract Classes

2017-12-06 Thread Ali Çehreli via Digitalmars-d-learn
On 12/06/2017 03:01 PM, IM wrote: > On Wednesday, 6 December 2017 at 07:54:21 UTC, Ali Çehreli wrote: >> On 12/05/2017 11:23 PM, IM wrote: >>> [...] >> >> Just remove the override keywords in this case. No function is >> overriding any implementation here, they both implement an interface >>

Re: Abstract Classes

2017-12-06 Thread IM via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 07:54:21 UTC, Ali Çehreli wrote: On 12/05/2017 11:23 PM, IM wrote: [...] Just remove the override keywords in this case. No function is overriding any implementation here, they both implement an interface function. The fact that override can be used for

Re: Debugging shared libs on windows

2017-12-06 Thread user1234 via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 21:17:55 UTC, Tofu ninja wrote: On Wednesday, 6 December 2017 at 21:12:20 UTC, Tofu ninja wrote: I am compiling with -m64 -shared -debug -g and a .pdb is generated but visual studio says the dll was not compiled with debug information, am I missing something or

Re: GUI app brings up console

2017-12-06 Thread Ivan Trombley via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 21:35:43 UTC, MrSmith wrote: On Wednesday, 6 December 2017 at 21:25:27 UTC, Ivan Trombley wrote: I created a cross-platform app using gtk-d. Everything works fine but when I run it from Windows, a console window is opened. How can I tell Windows that it's a GUI

Re: GUI app brings up console

2017-12-06 Thread MrSmith via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 21:25:27 UTC, Ivan Trombley wrote: I created a cross-platform app using gtk-d. Everything works fine but when I run it from Windows, a console window is opened. How can I tell Windows that it's a GUI application so that a console is not opened (keeping in mind

Re: Parsing a string from stdin using formattedRead

2017-12-06 Thread Mark via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 18:57:55 UTC, Ali Çehreli wrote: On 12/06/2017 10:47 AM, Mark wrote: > string info = readln(); > formattedRead(info, "%s %s", first_name, last_name); > > This piece of code works > formattedRead(readln(), "%s %s", first_name, last_name); > > But this raises a

GUI app brings up console

2017-12-06 Thread Ivan Trombley via Digitalmars-d-learn
I created a cross-platform app using gtk-d. Everything works fine but when I run it from Windows, a console window is opened. How can I tell Windows that it's a GUI application so that a console is not opened (keeping in mind that this app also needs to be compiled on Linux and Mac)?

Re: Problem getting Cimgui to work

2017-12-06 Thread Thomas via Digitalmars-d-learn
Hi folks! I got it to work, but honestly I don't know why.. :-) 1. clone project imgui_d_test with git 2. subloading the base cimgui stuff by command: git submodule update --init --recursive 3. enter cimgui directory and enter make 4. after that dub doesn't work properly, you have to edit

Re: Debugging shared libs on windows

2017-12-06 Thread Tofu ninja via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 21:12:20 UTC, Tofu ninja wrote: I am compiling with -m64 -shared -debug -g and a .pdb is generated but visual studio says the dll was not compiled with debug information, am I missing something or is this not supported? DMD32 D Compiler v2.076.0 Actually

Debugging shared libs on windows

2017-12-06 Thread Tofu ninja via Digitalmars-d-learn
I am compiling with -m64 -shared -debug -g and a .pdb is generated but visual studio says the dll was not compiled with debug information, am I missing something or is this not supported? DMD32 D Compiler v2.076.0

Re: What is "stringImportPaths"

2017-12-06 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 20:17:55 UTC, Ali Çehreli wrote: On 12/06/2017 11:05 AM, mrphobby wrote: > importing is a construct used for importing symbols, right? That's the import statement. -J compiler switch is about the import expression:

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/6/17 2:19 PM, A Guy With a Question wrote: On Wednesday, 6 December 2017 at 18:09:45 UTC, Steven Schveighoffer wrote: On 12/6/17 12:17 PM, Steven Schveighoffer wrote: So why wouldn't the compiler fail? Because it has no idea yet what you mean by Nullable. It doesn't even know if

Re: What is "stringImportPaths"

2017-12-06 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 19:05:24 UTC, mrphobby wrote: Can anyone explain what "stringImportPaths" is? I have seen this being used in dub.json files and I think I kind of know what it does, but I haven't been able to find a clear explanation in any documentation of what it does. It

Re: What is "stringImportPaths"

2017-12-06 Thread Ali Çehreli via Digitalmars-d-learn
On 12/06/2017 11:05 AM, mrphobby wrote: > importing is a construct used for importing symbols, right? That's the import statement. -J compiler switch is about the import expression: https://dlang.org/spec/expression.html#import_expressions Ali

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 19:40:49 UTC, A Guy With a Question wrote: On Wednesday, 6 December 2017 at 19:19:09 UTC, A Guy With a Question wrote: It seems D's fast compile times are achieved by skipping semantic checking and even parsing when it doesn't feel it's needed. I strongly

Re: Problem getting Cimgui to work

2017-12-06 Thread Thomas via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 19:37:54 UTC, Thomas wrote: On Wednesday, 6 December 2017 at 19:12:43 UTC, drug wrote: I've check it before posting using old version dmd 2.073 and it works. What dmd version you compile with? Hi. The newest as I know. Version 2.077.0 (64bit Version) But

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 19:19:09 UTC, A Guy With a Question wrote: It seems D's fast compile times are achieved by skipping semantic checking and even parsing when it doesn't feel it's needed. I strongly disagree with this decision. This could leave complex dormant time bombs that

Re: Problem getting Cimgui to work

2017-12-06 Thread Thomas via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 19:12:43 UTC, drug wrote: I've check it before posting using old version dmd 2.073 and it works. What dmd version you compile with? Hi. The newest as I know. Version 2.077.0 (64bit Version) But the error messages in my last post don't seem to relate to my

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 18:09:45 UTC, Steven Schveighoffer wrote: On 12/6/17 12:17 PM, Steven Schveighoffer wrote: So why wouldn't the compiler fail? Because it has no idea yet what you mean by Nullable. It doesn't even know if Nullable will be available or not. You could even import

Re: Problem getting Cimgui to work

2017-12-06 Thread drug via Digitalmars-d-learn
I've check it before posting using old version dmd 2.073 and it works. What dmd version you compile with?

What is "stringImportPaths"

2017-12-06 Thread mrphobby via Digitalmars-d-learn
Can anyone explain what "stringImportPaths" is? I have seen this being used in dub.json files and I think I kind of know what it does, but I haven't been able to find a clear explanation in any documentation of what it does. It does not look like anything I'm familiar with from other

Re: Problem getting Cimgui to work

2017-12-06 Thread Thomas via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 18:27:20 UTC, drug wrote: probably this can help you https://github.com/drug007/timespatial this project uses cimgui by means of derelict-imgui Hi, thank you. I tried it and first it seemed to work, but after I entered "dub build config=demo" following error

Re: Sort characters in string

2017-12-06 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Dec 06, 2017 at 10:32:03AM -0800, Ali Çehreli via Digitalmars-d-learn wrote: > On 12/06/2017 04:43 AM, Fredrik Boulund wrote: > > On Wednesday, 6 December 2017 at 10:42:31 UTC, Dgame wrote: > > > >> > >> Or you simply do > >> > >> writeln("longword".array.sort); > >> > > > >

Re: Parsing a string from stdin using formattedRead

2017-12-06 Thread Ali Çehreli via Digitalmars-d-learn
On 12/06/2017 10:47 AM, Mark wrote: > string info = readln(); > formattedRead(info, "%s %s", first_name, last_name); > > This piece of code works > formattedRead(readln(), "%s %s", first_name, last_name); > > But this raises a compilation error, claiming that formattedRead "cannot > deduce

Re: Problem getting Cimgui to work

2017-12-06 Thread Thomas via Digitalmars-d-learn
Could you describe what dub package you tried to build first of all? It helps to reproduce your case. Hello. In my personal project folder I only have: derelict-sdl2 version="~>3.1.0-alpha.2" derelict-imgui version="~>0.9.4" Then I realized that I needed the shared library file cimgui.so

Parsing a string from stdin using formattedRead

2017-12-06 Thread Mark via Digitalmars-d-learn
std.format has the function formattedRead which can be used to parse a string, e.g. string first_name; string last_name; string info = readln(); formattedRead(info, "%s %s", first_name, last_name); This piece of code works as intended. However, since I don't need the input after it's parsed,

Re: Sort characters in string

2017-12-06 Thread Ali Çehreli via Digitalmars-d-learn
On 12/06/2017 04:43 AM, Fredrik Boulund wrote: > On Wednesday, 6 December 2017 at 10:42:31 UTC, Dgame wrote: > >> >> Or you simply do >> >> writeln("longword".array.sort); >> > > This is so strange. I was dead sure I tried that but it failed for some > reason. But after trying it just

Re: Problem getting Cimgui to work

2017-12-06 Thread drug via Digitalmars-d-learn
probably this can help you https://github.com/drug007/timespatial this project uses cimgui by means of derelict-imgui

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/6/17 12:17 PM, Steven Schveighoffer wrote: So why wouldn't the compiler fail? Because it has no idea yet what you mean by Nullable. It doesn't even know if Nullable will be available or not. You could even import Nullable, but Nullable!T may be an error. To give an example of why the

Re: Problem getting Cimgui to work

2017-12-06 Thread drug via Digitalmars-d-learn
06.12.2017 20:51, Thomas пишет: Hi guys! I need some help or advice about Cimgui (a C-API for Imgui) because I have no idea how to get it working. First, I'm new to D (only a few weeks) and still learning. I have a small C++/C# background, but wanted to try something new. So D got into my

Problem getting Cimgui to work

2017-12-06 Thread Thomas via Digitalmars-d-learn
Hi guys! I need some help or advice about Cimgui (a C-API for Imgui) because I have no idea how to get it working. First, I'm new to D (only a few weeks) and still learning. I have a small C++/C# background, but wanted to try something new. So D got into my focus. I am working on Manjaro

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread Gary Willoughby via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 16:47:17 UTC, A Guy With a Question wrote: abstract class Test(T) { private: T thing; public: this(T theThing) { thing = theThing; thisdoesnotexist(); // expect compiler error right here } } ...but this compiles just fine.

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/6/17 12:04 PM, A Guy With a Question wrote: I really do think, regardless of if this is considered a template expansion, that dmd should be catching these obvious errors. When one writes interfaces and abstract classes they are generally not ready to implement the end class yet. And

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread Nick Treleaven via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 17:04:06 UTC, A Guy With a Question wrote: abstract class Test(T) Here you have a class template. It does produce there error when I do this: class Test2 : Test!int You instantiated the template, so the compiler can now type check the instantiated

building git druntime - range violation in extendedPathThen

2017-12-06 Thread Nick Treleaven via Digitalmars-d-learn
Hi, I checked out dmd and druntime this morning. dmd seems to build fine, but when I try druntime I get this error: $ make -f win32.mak ..\dmd\generated\windows\release\32\dmd -conf= -c -o- -Isrc -Iimport -Hfimport\core\sync\barrier.di src\core\sync\barrier.d DMD v2.077.1 DEBUG

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 16:49:51 UTC, A Guy With a Question wrote: module grrr.grr; abstract class Test(T) { private: T thing; public: this(T theThing) { thing = theThing; thisdoesnotexist(); // expect compiler error right here } } ...but this

Re: GUI program on Mac OS in D?

2017-12-06 Thread mrphobby via Digitalmars-d-learn
On Friday, 24 November 2017 at 15:56:21 UTC, Jacob Carlborg wrote: BTW, the following line [3] of the Dub file will embed the Info.plist file in the executable, which can be handy if you don't want to use application bundles. The Info.plist file is not always necessary, I think my sample

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 16:32:05 UTC, A Guy With a Question wrote: I have to be honest, I'm a little worried about all of this code I just translated and how much of it is actually valid...I hope I didn't waste my time. Ok, so I verified this much. I would expect an error from the

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 16:47:17 UTC, A Guy With a Question wrote: On Wednesday, 6 December 2017 at 16:32:05 UTC, A Guy With a Question wrote: I have to be honest, I'm a little worried about all of this code I just translated and how much of it is actually valid...I hope I didn't

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
I have to be honest, I'm a little worried about all of this code I just translated and how much of it is actually valid...I hope I didn't waste my time.

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 16:10:34 UTC, Atila Neves wrote: On Wednesday, 6 December 2017 at 16:07:41 UTC, A Guy With a Question wrote: Noticed several typos that dmd seems to have not picked up initially. Does dmd not compile all source code? I obviously wouldn't expect it to recompile

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 16:07:41 UTC, A Guy With a Question wrote: Noticed several typos that dmd seems to have not picked up initially. Does dmd not compile all source code? I obviously wouldn't expect it to recompile something unnecessarily, but in a few cases I've just seen it not

Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
Noticed several typos that dmd seems to have not picked up initially. Does dmd not compile all source code? I obviously wouldn't expect it to recompile something unnecessarily, but in a few cases I've just seen it not throw errors where it should have.

Re: Sort characters in string

2017-12-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/6/17 4:34 AM, Ola Fosheim Grøstad wrote: On Wednesday, 6 December 2017 at 09:24:33 UTC, Jonathan M Davis wrote: UTF-32 on the other hand is guaranteed to have a code unit be a full code point. I don't think the standard says that? Isn't this only because the current set is small enough

Re: Directory Size

2017-12-06 Thread Andrea Fontana via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 14:49:48 UTC, Vino wrote: Hi Andrea, Thank you very much, as your code is pretty good for our scenario, just one request, the above is a part of our main code where we have many such sub code and all of our sub code use the container

Re: Directory Size

2017-12-06 Thread Vino via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 09:16:56 UTC, Andrea Fontana wrote: On Tuesday, 5 December 2017 at 17:21:29 UTC, Vino wrote: Hi All, Is there any better ways to get the size of folders , The below code perfectly works , but i need return type as Array!(Tuple!(string, string)) rather then

Re: cannot deduce template lambda from argument

2017-12-06 Thread aliak via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 11:02:01 UTC, Jonathan M Davis wrote: If you only want one type, then given n that type; I'm pretty sure that it would be alias lambda = (int n) => n * n; if you wanted an int. But if you want to do anything more complicated with it, it would make more sense

Re: Sort characters in string

2017-12-06 Thread Fredrik Boulund via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 10:42:31 UTC, Dgame wrote: Or you simply do writeln("longword".array.sort); This is so strange. I was dead sure I tried that but it failed for some reason. But after trying it just now it also seems to work just fine. Thanks! :)

Re: cannot deduce template lambda from argument

2017-12-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, December 06, 2017 10:43:18 aliak via Digitalmars-d-learn wrote: > On Wednesday, 6 December 2017 at 08:10:26 UTC, Biotronic wrote: > > On Tuesday, 5 December 2017 at 23:01:43 UTC, aliak wrote: > >> immutable lambda(T) = (T n) => n * n; > > > > Generally, you'd want to write > > > >

Re: Sort characters in string

2017-12-06 Thread Dgame via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 09:25:20 UTC, Biotronic wrote: On Wednesday, 6 December 2017 at 08:59:09 UTC, Fredrik Boulund wrote: string word = "longword"; writeln(sort(word)); But that doesn't work because I guess a string is not the type of range required for sort? Yeah, narrow

Re: cannot deduce template lambda from argument

2017-12-06 Thread aliak via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 08:10:26 UTC, Biotronic wrote: On Tuesday, 5 December 2017 at 23:01:43 UTC, aliak wrote: immutable lambda(T) = (T n) => n * n; Generally, you'd want to write alias lambda = n => n * n; instead. That said, I don't see any reason why your syntax shouldn't

Re: Optimizing a bigint fibonacci

2017-12-06 Thread Biotronic via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 10:16:16 UTC, helxi wrote: On Wednesday, 6 December 2017 at 10:00:48 UTC, Biotronic wrote: AliasSeq!(a, b) = tuple( a * (2*b - a), a*a + b*b); [...] Nice. But why the AliasSeq? Just playing around a bit. The alternative is to

Re: Optimizing a bigint fibonacci

2017-12-06 Thread codephantom via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 09:59:12 UTC, codephantom wrote: On Wednesday, 6 December 2017 at 09:12:08 UTC, helxi wrote: This is question not directly related to language concepts, it's got more to do with the application. I would appreciate if anyone would point to me how I could

Re: Optimizing a bigint fibonacci

2017-12-06 Thread helxi via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 10:00:48 UTC, Biotronic wrote: On Wednesday, 6 December 2017 at 09:12:08 UTC, helxi wrote: [...] Here's my version:, based on fast squaring: auto fib(ulong n) { import std.bigint : BigInt; import std.meta : AliasSeq; import std.typecons : tuple;

Re: Sort characters in string

2017-12-06 Thread Fredrik Boulund via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 09:25:20 UTC, Biotronic wrote: In addition, sort does in-place sorting, so the input range is changed. Since D strings are immutable(char)[], changing the elements is disallowed. So in total, you'll need to convert from a string (immutable(char)[]) to a

Re: Sort characters in string

2017-12-06 Thread Fredrik Boulund via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 09:24:33 UTC, Jonathan M Davis wrote: If you have a string, and you _know_ that it's only ASCII, then either use representation or byCodeUnit to wrap it for the call to sort, but it _will_ have to be mutable, so string won't actually work. e.g. char[] str =

Re: Optimizing a bigint fibonacci

2017-12-06 Thread Biotronic via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 09:12:08 UTC, helxi wrote: This is question not directly related to language concepts, it's got more to do with the application. I would appreciate if anyone would point to me how I could optimize this bit of code Here's my version:, based on fast squaring:

Re: Optimizing a bigint fibonacci

2017-12-06 Thread codephantom via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 09:12:08 UTC, helxi wrote: This is question not directly related to language concepts, it's got more to do with the application. I would appreciate if anyone would point to me how I could optimize this bit of code Compile it with ldc ;-)

Re: Sort characters in string

2017-12-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, December 06, 2017 09:34:48 Ola Fosheim Grøstad via Digitalmars-d-learn wrote: > On Wednesday, 6 December 2017 at 09:24:33 UTC, Jonathan M Davis > > wrote: > > UTF-32 on the other hand is guaranteed to have a code unit be a > > full code point. > > I don't think the standard says

Re: lower case only first letter of word

2017-12-06 Thread codephantom via Digitalmars-d-learn
On Tuesday, 5 December 2017 at 13:31:17 UTC, Marc wrote: Does D have a native function to capitalize only the first letter of the word? (I'm asking that so I might avoid reinvent the wheel, which I did sometimes in D) // module test; import std.stdio; void main() {

Re: Sort characters in string

2017-12-06 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 09:24:33 UTC, Jonathan M Davis wrote: UTF-32 on the other hand is guaranteed to have a code unit be a full code point. I don't think the standard says that? Isn't this only because the current set is small enough to fit? So this may change as Unicode grows?

Re: Optimizing a bigint fibonacci

2017-12-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, December 06, 2017 09:12:08 helxi via Digitalmars-d-learn wrote: > void main() > { > import std.stdio, std.datetime; > > auto t0 = Clock.currTime; > writeln(fib(100_000)); > writeln(Clock.currTime - t0); > } On a complete sidenote, if you want to correctly time stuff, you

Re: Sort characters in string

2017-12-06 Thread Biotronic via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 08:59:09 UTC, Fredrik Boulund wrote: string word = "longword"; writeln(sort(word)); But that doesn't work because I guess a string is not the type of range required for sort? Yeah, narrow (non-UTF-32) strings are not random-access, since characters like 

Re: Sort characters in string

2017-12-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, December 06, 2017 08:59:09 Fredrik Boulund via Digitalmars-d- learn wrote: > Hi, > > I'm having some trouble sorting the individual characters in a > string. Searching around, I found this thread > (http://forum.dlang.org/post/mailman.612.1331659665.4860.digitalmars-d-lea >

Re: Directory Size

2017-12-06 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 5 December 2017 at 17:21:29 UTC, Vino wrote: Hi All, Is there any better ways to get the size of folders , The below code perfectly works , but i need return type as Array!(Tuple!(string, string)) rather then using the "Result.insertBack(d);

Optimizing a bigint fibonacci

2017-12-06 Thread helxi via Digitalmars-d-learn
This is question not directly related to language concepts, it's got more to do with the application. I would appreciate if anyone would point to me how I could optimize this bit of code auto fib(const int n) { import std.bigint; if (n == 0) return BigInt(0);

Sort characters in string

2017-12-06 Thread Fredrik Boulund via Digitalmars-d-learn
Hi, I'm having some trouble sorting the individual characters in a string. Searching around, I found this thread (http://forum.dlang.org/post/mailman.612.1331659665.4860.digitalmars-d-le...@puremagic.com) about a similar issue, but it feels quite old so I wanted to check if there is a clear

Re: cannot deduce template lambda from argument

2017-12-06 Thread Biotronic via Digitalmars-d-learn
On Tuesday, 5 December 2017 at 23:01:43 UTC, aliak wrote: immutable lambda(T) = (T n) => n * n; Generally, you'd want to write alias lambda = n => n * n; instead. That said, I don't see any reason why your syntax shouldn't work, and would argue it's a bug. Please file it in Bugzilla.

Re: Abstract Classes

2017-12-06 Thread bauss via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 07:23:29 UTC, IM wrote: Assume the following: interface IFace { void foo(); void bar(); } abstract class A : IFace { override void foo() {} } class B : A { override void bar() {} } Now why this fails to compiler with the following message: --->>>