On Wednesday, 20 July 2016 at 10:40:04 UTC, pineapple wrote:
There's also the shuffle module in mach.range which doesn't do
any auto-decoding:
https://github.com/pineapplemachine/mach.d/blob/master/mach/range/random/shuffle.d
Interesting project. Thanks for the link.
On Wednesday, 20 July 2016 at 08:30:37 UTC, Mike Parker wrote:
representation does not allocate any new memory. It points to
the same memory, same data. If we think of D arrays as
something like this:
struct Array(T) {
size_t len;
T* ptr;
}
Then representation is doing this:
Array
On Wednesday, 20 July 2016 at 08:02:07 UTC, Mike Parker wrote:
If you are absolutely, 100% certain that you are dealing with
ASCII, you can do this:
```
import std.string : representation;
randomShuffle(charArray.representation);
That will give you a ubyte[] for char[] and a ushort[] for
wc
Hi
I'm trying to shuffle a character array but I get some
compilation errors.
*
char[] upper = std.ascii.uppercase.dup;
randomShuffle!(typeof(upper))(upper);
randomShuffle(upper);
example.d(34): Error: template std.random.randomShuffle cannot
deduce function from argument types !(char[])(ch
On Tuesday, 19 July 2016 at 12:33:53 UTC, ag0aep6g wrote:
final const(ulong[char]) nucleotide_counts () const
{
return cached_counts;
}
OMG! I'm so blind.
Never thought of trying the obvious way.
Thank you
Thank you!
That clarified a lot of things for me.
Hi,
I'm trying the following code:
class counter
{
public:
final ulong[char] nucleotide_counts () const
{
return cached_counts;
}
private:
ulong[char] cached_counts;
}
void main()
{
}
I get the following error from the compiler:
Error: cannot implicitly convert ex
On Tuesday, 19 July 2016 at 09:57:27 UTC, Lodovico Giaretta wrote:
On Tuesday, 19 July 2016 at 09:42:40 UTC, celavek wrote:
Works for me:
size_t[char] counts;
const string dna_chain =
"AGCCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAGAGTGTCTGATAGCAGC";
counts['A'] = countchars(dna_chain,
On Tuesday, 19 July 2016 at 09:55:43 UTC, Jonathan M Davis wrote:
On Tuesday, July 19, 2016 09:41:32 John via Digitalmars-d-learn
wrote:
auto result = count(dna_chain, 'A');
or if you know that the string is always going to just contain
ASCII (as seems likely based on the example), then
stri
On Tuesday, 19 July 2016 at 09:41:32 UTC, John wrote:
On Tuesday, 19 July 2016 at 09:34:11 UTC, celavek wrote:
Hi,
I am trying to count characters in a string like:
const string dna_chain =
"AGCCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAGAGTGTCTGATAGCAGC";
counts['A'] = countchars!(dn
Hi,
I am trying to count characters in a string like:
const string dna_chain =
"AGCCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAGAGTGTCTGATAGCAGC";
counts['A'] = countchars!(dna_chain, 'A');
But I get a compilation error:
template instance countchars!(dna_chain, "C") does not match
tem
Thank you both for the very good insights. Community wise +1 :)
Thank you for the example.
I misunderstood the doc and I got a bit confused by the range -
in C++ I would have incremented the iterators but here I did not
know what to do exactly as I could not match the 2 different
concepts in functionality.
On Wednesday, 13 July 2016 at 10:41:44 UTC, ketmar wrote:
let's read the doc again: "Returns a tuple with the reduced
ranges that start with the two mismatched values." simple logic
allows us to guess that it should return tuple with two empty
ranges. and it really does.
I understand your
Hi,
I am trying to use the function "mismatch" from
std.algorithm.comparison like so:
int count = 0;
auto m = mismatch(lhs, rhs);
while (!m[0].empty)
{
++count;
m = mismatch(m[0], m[1]);
}
That goes into an infinite loop. What does mismatch return when
it cannot
actually find a mis
15 matches
Mail list logo