On 21-Oct-2015 19:21, Shriramana Sharma wrote:
Shriramana Sharma wrote:
iterating through a
string as a range will produce each semantically meaningful Unicode
character rather than each UTF-8 or UTF-16 codepoint, it does make sense
to do this.
Dear me... I meant UTF-8 encoded byte, rather
On 21-Oct-2015 20:35, Jacob Carlborg wrote:
On 2015-10-21 16:13, Shriramana Sharma wrote:
Why is it a mistake? That seems a very sane thing, although somewhat
quirky.
Since ElementType is a Range primitive, and apparently iterating
through a
string as a range will produce each semantically
John Colvin wrote:
>> But this is false, no? Since ElementType!string is char and not
>> dchar?
>
> No. char[], wchar[] and dchar[] all have ElementType dchar.
> Strings are special for ranges. It's a bad mistake, but it is
> what it is and apparently won't be changed.
Why is it a mistake? That
On Wednesday, 21 October 2015 at 14:13:43 UTC, Shriramana Sharma
wrote:
John Colvin wrote:
But this is false, no? Since ElementType!string is char and
not dchar?
No. char[], wchar[] and dchar[] all have ElementType dchar.
Strings are special for ranges. It's a bad mistake, but it is
what
On 2015-10-21 16:13, Shriramana Sharma wrote:
Why is it a mistake? That seems a very sane thing, although somewhat quirky.
Since ElementType is a Range primitive, and apparently iterating through a
string as a range will produce each semantically meaningful Unicode
character rather than each
Shriramana Sharma wrote:
> iterating through a
> string as a range will produce each semantically meaningful Unicode
> character rather than each UTF-8 or UTF-16 codepoint, it does make sense
> to do this.
Dear me... I meant UTF-8 encoded byte, rather than "codepoint", since all
characters have
On Wednesday, October 21, 2015 06:21 PM, Shriramana Sharma wrote:
> Dear me... I meant UTF-8 encoded byte, rather than "codepoint",
Also known as: code unit.
On Wednesday, 21 October 2015 at 10:08:24 UTC, Shriramana Sharma
wrote:
In Python I can do:
ints = [1, 2, 3]
chars = ['a', 'b', 'c']
for i, c in zip(ints, chars):
print(i, c)
Output:
1 a
2 b
3 c
But in D if I try:
import std.stdio, std.range;
void main ()
{
int [] ints = [1, 2, 3];
In Python I can do:
ints = [1, 2, 3]
chars = ['a', 'b', 'c']
for i, c in zip(ints, chars):
print(i, c)
Output:
1 a
2 b
3 c
But in D if I try:
import std.stdio, std.range;
void main ()
{
int [] ints = [1, 2, 3];
char [] chars = ['a', 'b', 'c'];
foreach(int i, char c; zip(ints,
On Wednesday, 21 October 2015 at 12:07:12 UTC, Shriramana Sharma
wrote:
John Colvin wrote:
static assert(is(ElementType!string == dchar));
But this is false, no? Since ElementType!string is char and not
dchar?
No. char[], wchar[] and dchar[] all have ElementType dchar.
Strings are
John Colvin wrote:
> static assert(is(ElementType!string == dchar));
But this is false, no? Since ElementType!string is char and not dchar?
> foreach(int i, dchar c; zip(ints, chars))
> or
> foreach(i, c; zip(ints, chars))
What's the diff betn char and dchar in this particular context?
--
11 matches
Mail list logo