dataframe implementations

2015-11-02 Thread Jay Norwood via Digitalmars-d-learn
I was reading about the Julia dataframe implementation yesterday, trying to understand their decisions and how D might implement. From my notes, 1. they are currently using a dictionary of column vectors. 2. for NA (not available) they are currently using an array of bytes, effectively as a

Re: dataframe implementations

2015-11-02 Thread Laeeth Isharc via Digitalmars-d-learn
On Monday, 2 November 2015 at 13:54:09 UTC, Jay Norwood wrote: I was reading about the Julia dataframe implementation yesterday, trying to understand their decisions and how D might implement. From my notes, 1. they are currently using a dictionary of column vectors. 2. for NA (not available)

Re: Access violation when calling C DLL from D

2015-11-02 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 2 November 2015 at 01:02:45 UTC, AnoHito wrote: Hi, I am trying to write a simple interface to the MRuby Ruby interpreter so I can use ruby scripts in my D program. I was able to get MRuby compiled as a DLL without too much difficulty, but the headers are very long and complicated,

Re: Access violation when calling C DLL from D

2015-11-02 Thread AnoHito via Digitalmars-d-learn
On Monday, 2 November 2015 at 15:56:20 UTC, Atila Neves wrote: Try this instead: https://github.com/jacob-carlborg/dstep It's been used to convert C Ruby declarations to D: https://github.com/jacob-carlborg/orbit/tree/master/ruby Atila I might try it later, but I don't think the header

Re: Capturing __FILE__ and __LINE in a variadic templated function

2015-11-02 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 06:14:14 UTC, Jonathan M Davis wrote: You should pretty much never use __FILE__ or __LINE__ as template arguments unless you actually need to. The reason is that it will end up creating a new instantiation of the template pretty much every time that it's used,

Re: Capturing __FILE__ and __LINE in a variadic templated function

2015-11-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, November 02, 2015 00:36:14 anonymous via Digitalmars-d-learn wrote: > On 01.11.2015 23:49, Adam D. Ruppe wrote: > > Yeah, just make the other args normal runtime instead of template: > > Or make it two nested templates: > > template show(T ...) > { > void show(string file =

Re: Efficiency of immutable vs mutable

2015-11-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, November 03, 2015 03:16:06 Andrew via Digitalmars-d-learn wrote: > I've written a short D program that involves many lookups into a > static array. When I make the array immutable the program runs > faster. This must mean that immutable is more than a restriction > on access, it must

Re: Capturing __FILE__ and __LINE in a variadic templated function

2015-11-02 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 06:14:14 UTC, Jonathan M Davis wrote: You should pretty much never use __FILE__ or __LINE__ as template arguments unless you actually need to. The reason is that it will end up creating a new instantiation of the template pretty much every time that it's used,

Re: Lazy std.algorithm.replace()

2015-11-02 Thread Nordlöw via Digitalmars-d-learn
On Monday, 2 November 2015 at 20:25:44 UTC, Adam D. Ruppe wrote: On Sunday, 1 November 2015 at 14:26:21 UTC, Nordlöw wrote: Is there a reason why Phobos doesn't contain a lazy range variant of std.string.replace? Would something like map work with the predicate being if(matches_needle)

Re: Lazy std.algorithm.replace()

2015-11-02 Thread Ali Çehreli via Digitalmars-d-learn
On 11/02/2015 04:22 AM, Nordlöw wrote: On Sunday, 1 November 2015 at 14:26:21 UTC, Nordlöw wrote: Is there a reason why Phobos doesn't contain a lazy range variant of std.string.replace? Ping. What is the use case? The implementation doesn't seem trivial to me as it needs to maintain an

Re: Lazy std.algorithm.replace()

2015-11-02 Thread Nordlöw via Digitalmars-d-learn
On Monday, 2 November 2015 at 19:53:09 UTC, Ali Çehreli wrote: On 11/02/2015 04:22 AM, Nordlöw wrote: On Sunday, 1 November 2015 at 14:26:21 UTC, Nordlöw wrote: Is there a reason why Phobos doesn't contain a lazy range variant of std.string.replace? Ping. What is the use case? Chaining

Re: Lazy std.algorithm.replace()

2015-11-02 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 1 November 2015 at 14:26:21 UTC, Nordlöw wrote: Is there a reason why Phobos doesn't contain a lazy range variant of std.string.replace? Would something like map work with the predicate being if(matches_needle) return replacement; else return original; ?

Re: Unionize range types

2015-11-02 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 01:55:27 UTC, Freddy wrote: Is there any way I can Unionize range Types? --- auto primeFactors(T)(T t, T div = 2) { if (t % div == 0) { return t.only.chain(primeFactors(t / div, div)); } if (div > t) { return []; } else

Re: how to make the commented out lines work when they are uncommented

2015-11-02 Thread Ali Çehreli via Digitalmars-d-learn
On 11/02/2015 08:43 PM, steven kladitis wrote: > import std.stdio, std.algorithm, std.array, std.traits,std.range, > std.typecons,std.complex; > > enum AreSortableArrayItems(T) = isMutable!T && > __traits(compiles, T.init < T.init) && >

Having some issues using Generator's yield with an interface

2015-11-02 Thread Ben via Digitalmars-d-learn
When I create a generator using an interface (or abstract class) I must cast the concrete instance to the interface. Why does the Generator not know that B is a implementation of the interface of A? /// Test Code interface A {} class B : A{} // Fails auto testGen1 = new Generator!A({

Re: Capturing __FILE__ and __LINE in a variadic templated function

2015-11-02 Thread Nordlöw via Digitalmars-d-learn
On Sunday, 1 November 2015 at 23:36:15 UTC, anonymous wrote: On 01.11.2015 23:49, Adam D. Ruppe wrote: Yeah, just make the other args normal runtime instead of template: Or make it two nested templates: template show(T...) { void show(string file = __FILE__, uint line = __LINE__,

Re: Access violation when calling C DLL from D

2015-11-02 Thread Atila Neves via Digitalmars-d-learn
On Monday, 2 November 2015 at 02:30:09 UTC, AnoHito wrote: On Monday, 2 November 2015 at 02:13:29 UTC, BBasile wrote: On Monday, 2 November 2015 at 01:02:45 UTC, AnoHito wrote: [...] the headers are very long and complicated, and porting them entirely to D would be a huge project in and of

Re: good reasons not to use D?

2015-11-02 Thread Laeeth Isharc via Digitalmars-d-learn
On Saturday, 31 October 2015 at 16:06:47 UTC, Russel Winder wrote: On Sat, 2015-10-31 at 15:41 +, tcak via Digitalmars-d-learn wrote: On Saturday, 31 October 2015 at 14:37:23 UTC, rumbu wrote: > On Friday, 30 October 2015 at 10:35:03 UTC, Laeeth Isharc > wrote: > > I'm writing a talk for

Re: good reasons not to use D?

2015-11-02 Thread Laeeth Isharc via Digitalmars-d-learn
On Sunday, 1 November 2015 at 09:07:56 UTC, Ilya Yaroshenko wrote: On Friday, 30 October 2015 at 10:35:03 UTC, Laeeth Isharc wrote: Any other thoughts? Floating point operations can be extended automatically (without some kind of 'fastmath' flag) up to 80bit fp on 32 bit intel processors.

Re: good reasons not to use D?

2015-11-02 Thread Laeeth Isharc via Digitalmars-d-learn
On Sunday, 1 November 2015 at 20:38:44 UTC, Freddy wrote: On Friday, 30 October 2015 at 10:35:03 UTC, Laeeth Isharc wrote: I'm writing a talk for codemesh on the use of D in finance. I want to start by addressing the good reasons not to use D. (We all know what the bad ones are). I don't

Re: good reasons not to use D?

2015-11-02 Thread Laeeth Isharc via Digitalmars-d-learn
On Saturday, 31 October 2015 at 05:25:06 UTC, ref2401 wrote: On Friday, 30 October 2015 at 10:35:03 UTC, Laeeth Isharc wrote: I'm writing a talk for codemesh on the use of D in finance. I want to start by addressing the good reasons not to use D. (We all know what the bad ones are). I don't

Re: dataframe implementations

2015-11-02 Thread Jay Norwood via Digitalmars-d-learn
On Monday, 2 November 2015 at 15:33:34 UTC, Laeeth Isharc wrote: Hi Jay. That may have been me. I have implemented something very basic, but you can read and write my proto dataframe to/from CSV and HDF5. The code is up here: https://github.com/Laeeth/d_dataframes yes, thanks. I

Re: Capturing __FILE__ and __LINE in a variadic templated function

2015-11-02 Thread Nordlöw via Digitalmars-d-learn
On Monday, 2 November 2015 at 09:02:28 UTC, Gary Willoughby wrote: On Monday, 2 November 2015 at 08:23:16 UTC, Nordlöw wrote: I need `T` to be an alias in order for .stringof to work. typeof(T).stringof No, I want the variable name from the calling scope. This works for a single argument.

Re: Capturing __FILE__ and __LINE in a variadic templated function

2015-11-02 Thread John Colvin via Digitalmars-d-learn
On Monday, 2 November 2015 at 09:16:09 UTC, Nordlöw wrote: On Monday, 2 November 2015 at 09:02:28 UTC, Gary Willoughby wrote: On Monday, 2 November 2015 at 08:23:16 UTC, Nordlöw wrote: I need `T` to be an alias in order for .stringof to work. typeof(T).stringof No, I want the variable name

Compiling DOtherSide

2015-11-02 Thread karabuta via Digitalmars-d-learn
Well, I use Ubuntu 14.04 and I have managed to get qt5.5 at my /opt/qt55 since the default(usr/lib) directory is occupied by qt4. Since DOtherSide looks for qt5 from usr/lib, how do I change it to now point to /opt/qt55? This is the setup in /opt/qt55 karabuta@mx:/opt/qt55$ ls bin

Re: Capturing __FILE__ and __LINE in a variadic templated function

2015-11-02 Thread Daniel N via Digitalmars-d-learn
On Monday, 2 November 2015 at 09:54:50 UTC, John Colvin wrote: Why can't I make Args a sequence of aliases? Works for me on multiple compilers. To be precise, this worked: Except it prints Arg instead of x, try: debug write(Args[i].stringof, " is ", Arg);

Re: Capturing __FILE__ and __LINE in a variadic templated function

2015-11-02 Thread Gary Willoughby via Digitalmars-d-learn
On Monday, 2 November 2015 at 08:23:16 UTC, Nordlöw wrote: I need `T` to be an alias in order for .stringof to work. typeof(T).stringof

Re: generate with state

2015-11-02 Thread Ali Çehreli via Digitalmars-d-learn
On 11/02/2015 03:56 PM, Freddy wrote: Is there a version of http://dlang.org/phobos/std_range.html#.generate with state. generate() already allows "callables", which can be a delegate: import std.stdio; import std.range; struct S { int i; int fun() { return i++; } }

generate with state

2015-11-02 Thread Freddy via Digitalmars-d-learn
Is there a version of http://dlang.org/phobos/std_range.html#.generate with state.

Re: Capturing __FILE__ and __LINE in a variadic templated function

2015-11-02 Thread Nordlöw via Digitalmars-d-learn
On Monday, 2 November 2015 at 09:54:50 UTC, John Colvin wrote: Works for me on multiple compilers. To be precise, this worked: template show(Args...) { void show(string file = __FILE__, uint line = __LINE__, string fun = __FUNCTION__)() { import std.stdio: write, writeln;

Re: Capturing __FILE__ and __LINE in a variadic templated function

2015-11-02 Thread Nordlöw via Digitalmars-d-learn
On Monday, 2 November 2015 at 11:44:45 UTC, Daniel N wrote: On Monday, 2 November 2015 at 11:36:27 UTC, Nordlöw wrote: I want it to print the name of Arg in the closing as x is 11 See my previous comment: Arg -> Args[i].stringof Ahh! Great! Thx!

Re: Capturing __FILE__ and __LINE in a variadic templated function

2015-11-02 Thread Daniel N via Digitalmars-d-learn
On Monday, 2 November 2015 at 11:36:27 UTC, Nordlöw wrote: I want it to print the name of Arg in the closing as x is 11 See my previous comment: Arg -> Args[i].stringof

Re: generate with state

2015-11-02 Thread Freddy via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 00:08:54 UTC, Ali Çehreli wrote: generate() already allows "callables", which can be a delegate: import std.stdio; import std.range; struct S { int i; int fun() { return i++; } } void main() { auto s = S(42); writefln("%(%s %)",

Re: Access violation when calling C DLL from D

2015-11-02 Thread AnoHito via Digitalmars-d-learn
Okay, I finally got it working. The problem was that mrb_value needed to be fully defined in order for my code to work, because it was being passed on the stack directly instead of by a pointer: struct mrb_value { union { mrb_float f; void* p;

Re: Efficiency of immutable vs mutable

2015-11-02 Thread TheFlyingFiddle via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 03:16:07 UTC, Andrew wrote: I've written a short D program that involves many lookups into a static array. When I make the array immutable the program runs faster. This must mean that immutable is more than a restriction on access, it must affect the compiler

Re: generate with state

2015-11-02 Thread Ali Çehreli via Digitalmars-d-learn
On 11/02/2015 04:51 PM, Freddy wrote: > On Tuesday, 3 November 2015 at 00:08:54 UTC, Ali Çehreli wrote: >> generate() already allows "callables", which can be a delegate: >> >> import std.stdio; >> import std.range; >> >> struct S { >> int i; >> >> int fun() { >> return i++; >>

Re: Unionize range types

2015-11-02 Thread TheFlyingFiddle via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 01:55:27 UTC, Freddy wrote: Is there any way I can Unionize range Types? --- auto primeFactors(T)(T t, T div = 2) { if (t % div == 0) { return t.only.chain(primeFactors(t / div, div)); } if (div > t) { return []; } else

how to make the commented out lines work when they are uncommented

2015-11-02 Thread steven kladitis via Digitalmars-d-learn
import std.stdio, std.algorithm, std.array, std.traits,std.range, std.typecons,std.complex; enum AreSortableArrayItems(T) = isMutable!T && __traits(compiles, T.init < T.init) && !isNarrowString!(T[]); void selectionSort(T)(T[]

Re: Lazy std.algorithm.replace()

2015-11-02 Thread Nordlöw via Digitalmars-d-learn
On Sunday, 1 November 2015 at 14:26:21 UTC, Nordlöw wrote: Is there a reason why Phobos doesn't contain a lazy range variant of std.string.replace? Ping.

Unionize range types

2015-11-02 Thread Freddy via Digitalmars-d-learn
Is there any way I can Unionize range Types? --- auto primeFactors(T)(T t, T div = 2) { if (t % div == 0) { return t.only.chain(primeFactors(t / div, div)); } if (div > t) { return []; } else { return primeFactors(t, div + 1); } } ---

Efficiency of immutable vs mutable

2015-11-02 Thread Andrew via Digitalmars-d-learn
I've written a short D program that involves many lookups into a static array. When I make the array immutable the program runs faster. This must mean that immutable is more than a restriction on access, it must affect the compiler output. But why and how? Thanks Andrew