On Wednesday, 20 July 2016 at 18:32:15 UTC, Jesse Phillips wrote:
I think you mean that your range library treats them as arrays
of code units, meaning your library will break (some) unicode
strings.
Right - I disagree with the assessment that all (or even most)
char[] types are intended to r
On Wednesday, 20 July 2016 at 16:44:11 UTC, ketmar wrote:
On Wednesday, 20 July 2016 at 13:33:34 UTC, Mike Parker wrote:
There is no auto-decoding going on here,
...
as char[] and wchar[] are rejected outright since they are not
considered random access ranges.
...due to autodecoding.
No,
On Wednesday, 20 July 2016 at 16:03:27 UTC, pineapple wrote:
On Wednesday, 20 July 2016 at 13:33:34 UTC, Mike Parker wrote:
There is no auto-decoding going on here, as char[] and wchar[]
are rejected outright since they are not considered random
access ranges.
They are considered random acces
On 07/20/2016 10:40 AM, Jack Stouffer wrote:
On Wednesday, 20 July 2016 at 17:31:18 UTC, Ali Çehreli wrote:
making it impossible to access randomly
making it impossible to access randomly __correctly__, unless you're
safely assuming there's only ASCII in your string.
Yes, perhaps I should ha
On Wednesday, 20 July 2016 at 17:31:18 UTC, Ali Çehreli wrote:
making it impossible to access randomly
making it impossible to access randomly __correctly__, unless
you're safely assuming there's only ASCII in your string.
On Wednesday, 20 July 2016 at 17:31:18 UTC, Ali Çehreli wrote:
I think both not being random access ranges and there is
auto-decoding in Phobos are design decisions due to the fact
that char[] is a multi-byte encoding.
Phobos could choose not to auto-decode but char[] would still
be multi-byt
On 07/20/2016 09:44 AM, ketmar wrote:
On Wednesday, 20 July 2016 at 13:33:34 UTC, Mike Parker wrote:
There is no auto-decoding going on here,
...
as char[] and wchar[] are rejected outright since they are not
considered random access ranges.
...due to autodecoding.
I think both not being r
On 07/20/2016 06:18 PM, Mike Parker wrote:
The relevant lines I quoted from the docs above explain quite clearly
that it's because they are multi-byte formats. Indexing them is not
inefficient, it simply makes no sense. What does it mean to take the
value at index i when it is part of a multi-byt
On Wednesday, 20 July 2016 at 13:33:34 UTC, Mike Parker wrote:
There is no auto-decoding going on here,
...
as char[] and wchar[] are rejected outright since they are not
considered random access ranges.
...due to autodecoding.
On Wednesday, 20 July 2016 at 16:08:26 UTC, pineapple wrote:
Pardon my being scatterbrained (and there not being an "edit
post" function) - you're referring to phobos not considering
char[] and wchar[] to have random access? The reason they are
not considered to have random access is because
On Wednesday, 20 July 2016 at 16:04:50 UTC, pineapple wrote:
On Wednesday, 20 July 2016 at 16:03:27 UTC, pineapple wrote:
On Wednesday, 20 July 2016 at 13:33:34 UTC, Mike Parker wrote:
There is no auto-decoding going on here, as char[] and
wchar[] are rejected outright since they are not consid
On Wednesday, 20 July 2016 at 16:03:27 UTC, pineapple wrote:
On Wednesday, 20 July 2016 at 13:33:34 UTC, Mike Parker wrote:
There is no auto-decoding going on here, as char[] and wchar[]
are rejected outright since they are not considered random
access ranges.
They are considered random acces
On Wednesday, 20 July 2016 at 13:33:34 UTC, Mike Parker wrote:
There is no auto-decoding going on here, as char[] and wchar[]
are rejected outright since they are not considered random
access ranges.
They are considered random access ranges by my ranges library,
because they are treated as ar
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 10:40:04 UTC, pineapple wrote:
On Wednesday, 20 July 2016 at 08:02:07 UTC, Mike Parker wrote:
You can then go to the documentation for
std.range.primitives.isRandomAccessRange [2], where you'll
find the following:
"Although char[] and wchar[] (as well as their qu
On Wednesday, 20 July 2016 at 08:02:07 UTC, Mike Parker wrote:
You can then go to the documentation for
std.range.primitives.isRandomAccessRange [2], where you'll find
the following:
"Although char[] and wchar[] (as well as their qualified
versions including string and wstring) are arrays,
i
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:18:55 UTC, celavek wrote:
As far as my current understanding goes the shuffle will be
done in place.
If I use the "representation" would that still hold, that is
will I be able
to use the same char[] but in the shuffled form? (of course I
will test that)
re
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
On Wednesday, 20 July 2016 at 08:05:20 UTC, Mike Parker wrote:
On Wednesday, 20 July 2016 at 08:02:07 UTC, Mike Parker wrote:
On Wednesday, 20 July 2016 at 07:49:38 UTC, celavek wrote:
If you are absolutely, 100% certain that you are dealing with
ASCII, you can do this:
And I forgot to ad
On Wednesday, 20 July 2016 at 08:02:07 UTC, Mike Parker wrote:
On Wednesday, 20 July 2016 at 07:49:38 UTC, celavek wrote:
If you are absolutely, 100% certain that you are dealing with
ASCII, you can do this:
And I forgot to add:
Otherwise, you'll want to convert to dchar[] (probably via
On Wednesday, 20 July 2016 at 07:49:38 UTC, celavek wrote:
I thought that I could use a dynamic array as a range ...
You can. However, if you take a look at the documentation for
std.random.randomShuffle [1], you'll find the following
constraint:
if (isRandomAccessRange!Range);
You can t
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 !
23 matches
Mail list logo