Re: Problems with Zlib - data error

2017-04-21 Thread Era Scarecrow via Digitalmars-d-learn
On Friday, 21 April 2017 at 17:40:03 UTC, Era Scarecrow wrote: I think I'll just go with full memory compression and make a quick simple filter to manage the large blocks of 0's to something more manageable. That will reduce the memory allocation issues. Done and I'm happy with the results.

Re: Algebra With Types

2017-04-21 Thread Meta via Digitalmars-d-learn
On Friday, 21 April 2017 at 18:54:38 UTC, David Sanders wrote: Thank-you for your input. With your help, I was able to figure out number whether a type is an instantiation of std.variant.Algebraic. Now, I need help on concatenating Template Sequence Parameters. See the block comments below.

Re: Compile time foreach with switch

2017-04-21 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Apr 21, 2017 at 07:17:32PM +, Adam D. Ruppe via Digitalmars-d-learn wrote: > On Friday, 21 April 2017 at 19:09:25 UTC, Johan Fjeldtvedt wrote: > > void foo(string s) { > > enum es = tuple("a", "b", "c"); > > switch (s) { > > foreach (e; es) { > > case e: > >

Re: Compile time foreach with switch

2017-04-21 Thread Johan Fjeldtvedt via Digitalmars-d-learn
On Friday, 21 April 2017 at 19:17:32 UTC, Adam D. Ruppe wrote: On Friday, 21 April 2017 at 19:09:25 UTC, Johan Fjeldtvedt wrote: void foo(string s) { enum es = tuple("a", "b", "c"); switch (s) { foreach (e; es) { case e: writeln("matched ", e); break

Re: Compile time foreach with switch

2017-04-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 21 April 2017 at 19:09:25 UTC, Johan Fjeldtvedt wrote: void foo(string s) { enum es = tuple("a", "b", "c"); switch (s) { foreach (e; es) { case e: writeln("matched ", e); break; } Let me remove some surrounding stuff and ask you wha

Re: Algebra With Types

2017-04-21 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Apr 21, 2017 at 06:54:38PM +, David Sanders via Digitalmars-d-learn wrote: [...] > Now, I need help on concatenating Template Sequence Parameters. See > the block comments below. [...] > } else static if (is(T _ == VariantN!V, V...)) { > static if(is(U _ == VariantN

Compile time foreach with switch

2017-04-21 Thread Johan Fjeldtvedt via Digitalmars-d-learn
I was a bit surprised to find out (https://forum.dlang.org/post/csiwyetjkttlxxnwn...@forum.dlang.org) that compile time foreach-loops can be used inside switch-statements. I tried the following: import std.stdio; import std.typecons; void foo(string s) { enum es = tuple("a", "b", "c");

Re: Algebra With Types

2017-04-21 Thread David Sanders via Digitalmars-d-learn
On Friday, 21 April 2017 at 17:33:22 UTC, Meta wrote: On Friday, 21 April 2017 at 16:31:37 UTC, H. S. Teoh wrote: On Fri, Apr 21, 2017 at 04:16:30PM +, David Sanders via Digitalmars-d-learn wrote: I'm trying to do algebra with types ala http://chris-taylor.github.io/blog/2013/02/10/the-alge

Re: htod for linux

2017-04-21 Thread Sebastien Alaiwan via Digitalmars-d-learn
On Friday, 21 April 2017 at 11:40:45 UTC, Mike Parker wrote: On Friday, 21 April 2017 at 10:54:26 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: Is there an htod for linux or an equivalent that works with Cpp, there is dstep but it does not support Cpp. From the very bottom of the htod doc page [

Re: Problems with Zlib - data error

2017-04-21 Thread Era Scarecrow via Digitalmars-d-learn
On Friday, 21 April 2017 at 12:57:25 UTC, Adam D. Ruppe wrote: But I didn't realize your thing was a literal example from the docs. Ugh, can't even trust that. Which was a larger portion of why I was confused by it all than otherwise. Still, it's much easier to salvage if I knew how the memo

Re: Algebra With Types

2017-04-21 Thread Meta via Digitalmars-d-learn
On Friday, 21 April 2017 at 16:31:37 UTC, H. S. Teoh wrote: On Fri, Apr 21, 2017 at 04:16:30PM +, David Sanders via Digitalmars-d-learn wrote: I'm trying to do algebra with types ala http://chris-taylor.github.io/blog/2013/02/10/the-algebra-of-algebraic-data-types/ Below you will find my a

Re: htod for linux

2017-04-21 Thread Matthias Klumpp via Digitalmars-d-learn
You may also want to try dstep - I just recently used that tool for the first time, and it worked really well (required a bit of tweaking of the source and result files though, but nothing major). => https://github.com/jacob-carlborg/dstep

Re: Algebra With Types

2017-04-21 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Apr 21, 2017 at 04:16:30PM +, David Sanders via Digitalmars-d-learn wrote: > I'm trying to do algebra with types ala > http://chris-taylor.github.io/blog/2013/02/10/the-algebra-of-algebraic-data-types/ > > Below you will find my attempts at "adding" types in D. I've outlined the > pa

Algebra With Types

2017-04-21 Thread David Sanders via Digitalmars-d-learn
I'm trying to do algebra with types ala http://chris-taylor.github.io/blog/2013/02/10/the-algebra-of-algebraic-data-types/ Below you will find my attempts at "adding" types in D. I've outlined the parts I'm having trouble with using block comments. 1) How do I figure out whether a type is an

Re: htod for linux

2017-04-21 Thread via Digitalmars-d-learn
I think we need a dub package for the cpp standard library. If somebody has managed to get that together, it would be a great step towards better cpp interoperability.

Re: DMD requirements (VC runtime version) where?

2017-04-21 Thread XavierAP via Digitalmars-d-learn
On Friday, 21 April 2017 at 11:37:07 UTC, Mike Parker wrote: sc.ini manually is the better option if you don't need or want the 2015 build tools. Thanks! Nevertheless I think it would be good that the supported version of VS is documented on the website of DMD, just like it is on VisualD's.

Re: Problems with Zlib - data error

2017-04-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 21 April 2017 at 11:18:55 UTC, Era Scarecrow wrote: So that's what's going on. But if I have to dup the blocks then I have the same problem as before with limited memory issues. I kinda wish more there was the gz_open that is in the C interface and let it deal with the decompression

Re: Playing arround with mixin - alias?

2017-04-21 Thread ketmar via Digitalmars-d-learn
Martin Tschierschke wrote: i doubt so. So my "solution" on how to get a short cut for using: writeln(mixin(interp!"${name} you are app. ${age*365} days old")); .. NEVER. EVER. USE. THE. FOLOWING. IN. YOUR. CODE. NEVER!!! import std.stdio; mixin template usesexpand() { import std.f

Re: htod for linux

2017-04-21 Thread via Digitalmars-d-learn
On Friday, 21 April 2017 at 12:10:04 UTC, Mike Parker wrote: The only thing I'm aware of is Binderoo [1]. According to the currently skinny wiki, binderoo_util [2] can be used to generate bindings if you're invested in using the whole set up. Ethan's scheduled to give a talk about it on Day 2 o

Re: htod for linux

2017-04-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 21 April 2017 at 12:04:02 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: On Friday, 21 April 2017 at 11:40:45 UTC, Mike Parker wrote: "No Linux version." That's a shame, any alternative with cpp support? It's quite painful to "port" something ubiquitous like std::string by hand. base

Re: Playing arround with mixin - alias?

2017-04-21 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 21 April 2017 at 11:58:13 UTC, Martin Tschierschke wrote: On Friday, 21 April 2017 at 10:31:46 UTC, ketmar wrote: biozic wrote: I thought way to complicated: Just define the string at top: enum exho="auto mixinter(string x)(){return mixin(interp!x);} auto exho(string x)(){return m

Re: htod for linux

2017-04-21 Thread via Digitalmars-d-learn
On Friday, 21 April 2017 at 11:40:45 UTC, Mike Parker wrote: "No Linux version." That's a shame, any alternative with cpp support? It's quite painful to "port" something ubiquitous like std::string by hand. base_string.h is ugly, is arcane, even a parser would have a hard time with it. Hopef

Re: Playing arround with mixin - alias?

2017-04-21 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 21 April 2017 at 10:31:46 UTC, ketmar wrote: biozic wrote: On Friday, 21 April 2017 at 09:42:33 UTC, ketmar wrote: Martin Tschierschke wrote: Is it possible to define an alias for something like mixin(import("local_function_file.d")); to write only use_local_function; whic

Re: htod for linux

2017-04-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 21 April 2017 at 10:54:26 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: Is there an htod for linux or an equivalent that works with Cpp, there is dstep but it does not support Cpp. From the very bottom of the htod doc page [1]: "No Linux version." https://dlang.org/htod.html

Re: DMD requirements (VC runtime version) where?

2017-04-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 21 April 2017 at 11:23:16 UTC, XavierAP wrote: Visual D has just added support for VS 2017 (kudos), whereas before I had to stick with 2015 at the latest. But DMD has an additional dependency on VS (for x64), and it is not documented, as far as I've been able to find, which versions.

Re: Can we disallow appending integer to string?

2017-04-21 Thread Nick Treleaven via Digitalmars-d-learn
On Friday, 21 April 2017 at 08:36:12 UTC, Nick Treleaven wrote: Converting from char types -> integers, whilst (arguably) bug prone, at least is numerically sound. So perhaps we could disallow uint -> dchar, which is unsound. That is in the general case - when VRP can prove an integer fits wi

DMD requirements (VC runtime version) where?

2017-04-21 Thread XavierAP via Digitalmars-d-learn
Visual D has just added support for VS 2017 (kudos), whereas before I had to stick with 2015 at the latest. But DMD has an additional dependency on VS (for x64), and it is not documented, as far as I've been able to find, which versions. So I just tried, and now the DMD Windows installer compl

Re: Problems with Zlib - data error

2017-04-21 Thread Era Scarecrow via Digitalmars-d-learn
On Thursday, 20 April 2017 at 20:24:15 UTC, Adam D. Ruppe wrote: In short, byChunk reuses its buffer, and std.zlib holds on to the pointer. That combination leads to corrupted data. Easiest fix is to .dup the chunk... So that's what's going on. But if I have to dup the blocks then I have th

htod for linux

2017-04-21 Thread via Digitalmars-d-learn
Is there an htod for linux or an equivalent that works with Cpp, there is dstep but it does not support Cpp.

Re: Playing arround with mixin - alias?

2017-04-21 Thread ketmar via Digitalmars-d-learn
biozic wrote: On Friday, 21 April 2017 at 09:42:33 UTC, ketmar wrote: Martin Tschierschke wrote: Is it possible to define an alias for something like mixin(import("local_function_file.d")); to write only use_local_function; which will be translated to: mixin(import("local_function_fil

Re: Playing arround with mixin - alias?

2017-04-21 Thread biozic via Digitalmars-d-learn
On Friday, 21 April 2017 at 09:42:33 UTC, ketmar wrote: Martin Tschierschke wrote: Is it possible to define an alias for something like mixin(import("local_function_file.d")); to write only use_local_function; which will be translated to: mixin(import("local_function_file.d")); (this

Re: Playing arround with mixin - alias?

2017-04-21 Thread ketmar via Digitalmars-d-learn
Martin Tschierschke wrote: Is it possible to define an alias for something like mixin(import("local_function_file.d")); to write only use_local_function; which will be translated to: mixin(import("local_function_file.d")); (this additionally needs the file local_function_file.d in sourc

Re: Playing arround with mixin - alias?

2017-04-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, April 21, 2017 09:31:52 Martin Tschierschke via Digitalmars-d- learn wrote: > Is it possible to define an alias for something like > > mixin(import("local_function_file.d")); > > to write only > > use_local_function; > > which will be translated to: > mixin(import("local_function_fil

Playing arround with mixin - alias?

2017-04-21 Thread Martin Tschierschke via Digitalmars-d-learn
Is it possible to define an alias for something like mixin(import("local_function_file.d")); to write only use_local_function; which will be translated to: mixin(import("local_function_file.d")); (this additionally needs the file local_function_file.d in source/ + -J./source as paramete

Re: Can we disallow appending integer to string?

2017-04-21 Thread Nick Treleaven via Digitalmars-d-learn
On Thursday, 20 April 2017 at 11:05:00 UTC, Nick Treleaven wrote: On Wednesday, 19 April 2017 at 14:50:38 UTC, Stanislav Blinov wrote: Because integrals implicitly convert to characters of same width (byte -> char, short -> wchar, int -> dchar). Despite char.min > byte.min, char.max < byte.max

Re: Can we disallow appending integer to string?

2017-04-21 Thread XavierAP via Digitalmars-d-learn
On Wednesday, 19 April 2017 at 14:50:38 UTC, Stanislav Blinov wrote: On Wednesday, 19 April 2017 at 14:36:13 UTC, Nick Treleaven Why is it legal to append an integer? Because integrals implicitly convert to characters of same width (byte -> char, short -> wchar, int -> dchar). Huh... I had