Re: Cannot deduce function types for argument

2018-02-25 Thread ARaspiK via Digitalmars-d-learn
On Sunday, 25 February 2018 at 18:39:31 UTC, ARaspiK wrote: I'm making a calendar (basically improvements to https://wiki.dlang.org/Component_programming_with_ranges) and I'm getting a lot of `cannot deduce function from argument types` errors when using range-based mapping code. Here's my

Re: Zip with range of ranges

2018-02-25 Thread ARaspiK via Digitalmars-d-learn
On Sunday, 25 February 2018 at 20:18:27 UTC, Paul Backus wrote: On Sunday, 25 February 2018 at 16:22:19 UTC, ARaspiK wrote: Instead of passing std.range.zip a set of ranges as different arguments, is it possible to hand the m a range of ranges, and get them to zip together each element of

Re: Help using lubeck on Windows

2018-02-25 Thread jmh530 via Digitalmars-d-learn
On Sunday, 25 February 2018 at 14:25:04 UTC, Arredondo wrote: On Friday, 23 February 2018 at 16:56:13 UTC, jmh530 wrote: I had given up and used WSL at this point rather than compile it myself with CMAKE. Less of a headache. I don’t understand. Wouldn’t WSL produce Linux binaries? I need my

Re: Game and GC

2018-02-25 Thread Leonardo via Digitalmars-d-learn
On Saturday, 24 February 2018 at 07:12:21 UTC, Guillaume Piolat wrote: From my experience a combination of the following is necessary: - not having the audio thread registered - using pools aggressively for game entities I'll read the resources you gave. Thanks for the all answers. Great

Re: iota to array

2018-02-25 Thread Harry via Digitalmars-d-learn
On Sunday, 25 February 2018 at 13:33:07 UTC, psychoticRabbit wrote: On Sunday, 25 February 2018 at 12:13:31 UTC, Andrea Fontana wrote: On Sunday, 25 February 2018 at 09:30:12 UTC, psychoticRabbit wrote: I would have preffered it defaulted java style ;-) System.out.println(1.0); // i.e. it

Re: Forward references

2018-02-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/25/18 6:53 PM, Jiyan wrote: On Sunday, 25 February 2018 at 22:20:13 UTC, Steven Schveighoffer wrote: On 2/25/18 4:25 PM, Jiyan wrote: [...] Looks like this was fixed in 2.064. What version of the compiler are you using? -Steve 2.077.0 It is really strange, it works now but there

Re: Searching string for character in binary search

2018-02-25 Thread Joel via Digitalmars-d-learn
On Sunday, 25 February 2018 at 21:18:55 UTC, Joel wrote: The number tests work, but not the string one. Thanks guys. I worked it out, I thought my search code was right, since the first asserts worked.

Re: countUntil to print all the index of a given string.

2018-02-25 Thread Andrew via Digitalmars-d-learn
On Sunday, 25 February 2018 at 13:25:56 UTC, Vino wrote: On Sunday, 25 February 2018 at 03:41:27 UTC, Jonathan M Davis wrote: On Sunday, February 25, 2018 02:58:33 Seb via Digitalmars-d-learn wrote: [...] That will help eventually, but it requires a compiler flag, so it's really not going

Re: Forward references

2018-02-25 Thread Jiyan via Digitalmars-d-learn
On Sunday, 25 February 2018 at 22:20:13 UTC, Steven Schveighoffer wrote: On 2/25/18 4:25 PM, Jiyan wrote: [...] Looks like this was fixed in 2.064. What version of the compiler are you using? -Steve 2.077.0 It is really strange, it works now but there still seems to be some strangeness

Re: Forward references

2018-02-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/25/18 4:25 PM, Jiyan wrote: Hi, is there any document or text describing forward references? It is kinda strange, i implemented a list structure which is kinda like this: struct list(T) { private: struct node { T val; node* next; node* prev; } node* head; node* last; size_t size;  

Re: Searching string for character in binary search

2018-02-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/25/18 4:32 PM, Seb wrote: Also note that Phobos comes with binary search built-in: --- assert([1,2,3,4,5,6,7,8,9,10,11].assumeSorted.canFind(6)); --- https://run.dlang.io/is/bfpBpA canFind (and find) works even on non-sorted ranges, so it's not the greatest proof. But it's good to

Re: Forward references

2018-02-25 Thread ketmar via Digitalmars-d-learn
works for me with 2.076.

Re: Destructor called twice.

2018-02-25 Thread ketmar via Digitalmars-d-learn
add postblit debug prints, and you will see.

Re: Searching string for character in binary search

2018-02-25 Thread Seb via Digitalmars-d-learn
On Sunday, 25 February 2018 at 21:18:55 UTC, Joel wrote: The number tests work, but not the string one. void main() { assert([1,2,3,4,5,6,7,8,9,10,11].binarySearch(6)); assert(! [1,2,3,4,5,7,8,9,10,11].binarySearch(6)); assert("abcdefghijklmnopqrstuvwxyz".binarySearch('j')); // not

Forward references

2018-02-25 Thread Jiyan via Digitalmars-d-learn
Hi, is there any document or text describing forward references? It is kinda strange, i implemented a list structure which is kinda like this: struct list(T) { private: struct node { T val; node* next; node* prev; } node* head; node* last; size_t size; . } The thing is when i

Re: Searching string for character in binary search

2018-02-25 Thread ag0aep6g via Digitalmars-d-learn
On 02/25/2018 10:18 PM, Joel wrote:     if (arr[i]  > n)     arr = arr[i + 1 .. $]; When `arr[i]` is greater than `n`, then the values in `arr[i + 1 .. $]` will only be even greater. You're picking the wrong half of the array.

Searching string for character in binary search

2018-02-25 Thread Joel via Digitalmars-d-learn
The number tests work, but not the string one. void main() { assert([1,2,3,4,5,6,7,8,9,10,11].binarySearch(6)); assert(! [1,2,3,4,5,7,8,9,10,11].binarySearch(6)); assert("abcdefghijklmnopqrstuvwxyz".binarySearch('j')); // not work import std.stdio; writeln("Assert tests

Destructor called twice.

2018-02-25 Thread TheFlyingFiddle via Digitalmars-d-learn
When writing some code to setup properties in a chain function manner I ran into some unexpected behavior with destructors. Example: struct S { int a, b; ref S foo(int b) { this.b = b; return this; } this(int ab) { this.a = this.b = ab;

Re: Zip with range of ranges

2018-02-25 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 25 February 2018 at 16:22:19 UTC, ARaspiK wrote: Instead of passing std.range.zip a set of ranges as different arguments, is it possible to hand the m a range of ranges, and get them to zip together each element of every subrange? `std.range.transposed` does this, but it requires

Cannot deduce function types for argument

2018-02-25 Thread ARaspiK via Digitalmars-d-learn
I'm making a calendar (basically improvements to https://wiki.dlang.org/Component_programming_with_ranges) and I'm getting a lot of `cannot deduce function from argument types` errors when using range-based mapping code. Here's my current code: https://pastebin.com/TqAkggEw My testing: `rdmd

Re: How to compile C++ and D code, and linking them together on Windows,I will use c++ function In D? Thanks.

2018-02-25 Thread FrankLike via Digitalmars-d-learn
On Sunday, 25 February 2018 at 15:38:31 UTC, FrankLike wrote: Hi,everyone, How to compile C++ and D code, and linking them together on Windows ? I will use c++ function In D. I use vs2010 c++ on Windows, What should I do? For example: 1. create 2 files: C++.cpp D.d 2. I get the C++.obj

Zip with range of ranges

2018-02-25 Thread ARaspiK via Digitalmars-d-learn
Instead of passing std.range.zip a set of ranges as different arguments, is it possible to hand the m a range of ranges, and get them to zip together each element of every subrange?

Re: Help using lubeck on Windows

2018-02-25 Thread FrankLike via Digitalmars-d-learn
On Sunday, 25 February 2018 at 14:26:24 UTC, Arredondo wrote: On Friday, 23 February 2018 at 18:29:09 UTC, Ilya Yaroshenko wrote: full days now. All the .lib/.a files I have tried for BLAS and to do: dmd -L .\openblas.lib put the lib file in your code path. Error 42: Symbol Undefined

Re: Vibe.d no more using static this() {}

2018-02-25 Thread aberba via Digitalmars-d-learn
On Sunday, 25 February 2018 at 01:15:06 UTC, Seb wrote: On Friday, 23 February 2018 at 23:11:13 UTC, aberba wrote: I recently noticed vibe.d now using main loop which call the vibe.d event loop. "Recently"? FWIW this has been phased out a long time ago ;-) That's how I've been doing it

How to compile C++ and D code, and linking them together on Windows, I will use c++ function In D? Thanks.

2018-02-25 Thread FrankLike via Digitalmars-d-learn
Hi,everyone, How to compile C++ and D code, and linking them together on Windows ? I will use c++ function In D. I use vs2010 c++ on Windows, What should I do? For example: 1. create 2 files: C++.cpp D.d 2. I get the C++.obj fiel by vs2010. 3. I get the D.obj by dmd -c -m32mscoff Then how

Re: iota to array

2018-02-25 Thread rumbu via Digitalmars-d-learn
On Sunday, 25 February 2018 at 13:33:07 UTC, psychoticRabbit wrote: can someone please design a language that does what I tell it! please!! is that so hard?? print 1.0 does not mean go and print 1 .. it means go and print 1.0 languages are too much like people.. always thinking for

Re: iota to array

2018-02-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/25/18 8:33 AM, psychoticRabbit wrote: On Sunday, 25 February 2018 at 12:13:31 UTC, Andrea Fontana wrote: On Sunday, 25 February 2018 at 09:30:12 UTC, psychoticRabbit wrote: I would have preffered it defaulted java style ;-) System.out.println(1.0); // i.e. it prints 'what I told it to

Re: Help using lubeck on Windows

2018-02-25 Thread Arredondo via Digitalmars-d-learn
On Friday, 23 February 2018 at 16:56:13 UTC, jmh530 wrote: I had given up and used WSL at this point rather than compile it myself with CMAKE. Less of a headache. I don’t understand. Wouldn’t WSL produce Linux binaries? I need my project compiled as a Windows .exe, other parts of my

Re: Help using lubeck on Windows

2018-02-25 Thread Arredondo via Digitalmars-d-learn
On Friday, 23 February 2018 at 18:29:09 UTC, Ilya Yaroshenko wrote: openblas.net contains precompiled openblas library for Windows. It may not be optimised well for exactly your CPU but it is fast enought to start. Put the library files into your prodject and add openblas library to your

Re: iota to array

2018-02-25 Thread psychoticRabbit via Digitalmars-d-learn
On Sunday, 25 February 2018 at 12:13:31 UTC, Andrea Fontana wrote: On Sunday, 25 February 2018 at 09:30:12 UTC, psychoticRabbit wrote: I would have preffered it defaulted java style ;-) System.out.println(1.0); // i.e. it prints 'what I told it to print'. System.out.println(1.0); // print

Re: countUntil to print all the index of a given string.

2018-02-25 Thread Vino via Digitalmars-d-learn
On Sunday, 25 February 2018 at 03:41:27 UTC, Jonathan M Davis wrote: On Sunday, February 25, 2018 02:58:33 Seb via Digitalmars-d-learn wrote: [...] That will help eventually, but it requires a compiler flag, so it's really not going to help for code in general right now, and the fact that

Re: iota to array

2018-02-25 Thread Andrea Fontana via Digitalmars-d-learn
On Sunday, 25 February 2018 at 09:30:12 UTC, psychoticRabbit wrote: I would have preffered it defaulted java style ;-) System.out.println(1.0); // i.e. it prints 'what I told it to print'. System.out.println(1.0); // print 1.0 System.out.println(1.0); // print 1.0 So it doesn't print

Re: iota to array

2018-02-25 Thread psychoticRabbit via Digitalmars-d-learn
On Sunday, 25 February 2018 at 08:46:19 UTC, rumbu wrote: On Sunday, 25 February 2018 at 08:08:30 UTC, psychoticRabbit wrote: But umm what happended to the principle of least astonishment? writeln(1.1); (prints 1.1) whereas.. writeln(1.0); (prints 1) I don't get it. Cause it's

Re: iota to array

2018-02-25 Thread rumbu via Digitalmars-d-learn
On Sunday, 25 February 2018 at 08:08:30 UTC, psychoticRabbit wrote: But umm what happended to the principle of least astonishment? writeln(1.1); (prints 1.1) whereas.. writeln(1.0); (prints 1) I don't get it. Cause it's 'nicer'?? Because writeln(someFloat) is equivalent to

Re: iota to array

2018-02-25 Thread psychoticRabbit via Digitalmars-d-learn
On Sunday, 25 February 2018 at 06:35:07 UTC, Jonathan M Davis wrote: It's not printing ints. It's printing doubles. It's just that all of the doubles have nothing to the right of the decimal point, so they don't get printed with a decimal point. If you did something like start with 1.1, then