Re: Can I call the default opAssign after overloading opAssign?

2012-11-16 Thread Jonathan M Davis
On Friday, November 16, 2012 21:31:26 Rob T wrote: > My understanding is that a struct will have a default postblit > opAssign. What I want to know is if I can call the default > opAssign after overriding it, or is it inaccessible? > > I know that I do not have to execute the default after > overr

Can I call the default opAssign after overloading opAssign?

2012-11-16 Thread Rob T
My understanding is that a struct will have a default postblit opAssign. What I want to know is if I can call the default opAssign after overriding it, or is it inaccessible? I know that I do not have to execute the default after overriding, but if I can call it, I'd like to know because in s

Re: How to call external program in D

2012-11-16 Thread Sparsh Mittal
Thanks a lot, it was very helpful.

Re: How to call external program in D

2012-11-16 Thread Adam D. Ruppe
On Friday, 16 November 2012 at 19:15:09 UTC, Sparsh Mittal wrote: I want to call an external program (e.g. ls or date) in D. This function should do for many tasks: http://dlang.org/phobos/std_process.html#shell string shell(string cmd); Runs cmd in a shell and returns its standard outpu

Re: how to count number of letters with std.algorithm.count / std.algorithm.reduce / std.algorithm.map ?

2012-11-16 Thread Simen Kjaeraas
On 2012-11-16, 17:37, bearophile wrote: Simen Kjaeraas: There. Now it works, and returns a Tuple!(ulong,ulong)(8, 8). One thing I think is ugly in my implementation is acc + (seq == 'G'). This adds a bool and a ulong together. For more points, replace that with acc + (seq == 'G' ? 1 : 0).

Re: how to count number of letters with std.algorithm.count / std.algorithm.reduce / std.algorithm.map ?

2012-11-16 Thread bearophile
Simen Kjaeraas: There. Now it works, and returns a Tuple!(ulong,ulong)(8, 8). One thing I think is ugly in my implementation is acc + (seq == 'G'). This adds a bool and a ulong together. For more points, replace that with acc + (seq == 'G' ? 1 : 0). I use a pragmatic approach: I use such h

Re: how to count number of letters with std.algorithm.count / std.algorithm.reduce / std.algorithm.map ?

2012-11-16 Thread Simen Kjaeraas
On 2012-11-16, 16:49, bioinfornatics wrote: hi, I would like to count number of one ore more letter into a string or list of string (string[]) without use a for loop but instead using std.algorithm to compute efficiently. if you have: string seq1 = "ACGATCGATCGATCGCGCTAGCTAGCTAG"; s

Re: how to count number of letters with std.algorithm.count / std.algorithm.reduce / std.algorithm.map ?

2012-11-16 Thread bearophile
bioinfornatics: I would like to count number of one ore more letter into a string or list of string (string[]) without use a for loop but instead using std.algorithm to compute efficiently. If it's speed you look for, then most times std.algorithm is not the solution. Basic loops are usually

how to count number of letters with std.algorithm.count / std.algorithm.reduce / std.algorithm.map ?

2012-11-16 Thread bioinfornatics
hi, I would like to count number of one ore more letter into a string or list of string (string[]) without use a for loop but instead using std.algorithm to compute efficiently. if you have: string seq1 = "ACGATCGATCGATCGCGCTAGCTAGCTAG"; string[] seq2 = ["ACGATCGATCGATCGCGCTAGCTAGCTAG",

Re: Calls to struct methods and immutable

2012-11-16 Thread Joseph Rushton Wakeling
On 11/16/2012 12:55 PM, Joseph Rushton Wakeling wrote: The trouble is that it's not such a simple structure: it's actually more like, I should add that I'm not trying to be coy about revealing my code; I'm happy to do so, but as it's a rather long file I don't want to oblige anyone to have to

Re: Calls to struct methods and immutable

2012-11-16 Thread Joseph Rushton Wakeling
On 11/16/2012 05:51 AM, Ali Çehreli wrote: However, if makeFoo() does not care, then it would be better if it returned a mutable Foo: Foo makeFoo() pure In that case the callers could decide whether they wanted to have the returned object as mutable or immutable: immutable ifoo = makeFoo(