tcak:
Well, that's just disguising what we can't do.
When the a..b syntax was added to foreach() someone criticized
that syntax saing it's a one trick pony, and indeed I don't
know why Walter didn't make it a little more first-class.
But note that in D the a..b ranges are always open on
On Thursday, January 22, 2015 05:56:39 tcak via Digitalmars-d-learn wrote:
I want to define alphanumeric characters in an easy way.
Something like that:
char[] arr = ['a'..'z', 'A'..'Z', '0'..'9'];
Though above example doesn't work. Is there any easy way to do
this?
I am trying to do
On Thursday, 22 January 2015 at 07:29:05 UTC, anony wrote:
On Thursday, 22 January 2015 at 05:56:40 UTC, tcak wrote:
I want to define alphanumeric characters in an easy way.
Something like that:
char[] arr = ['a'..'z', 'A'..'Z', '0'..'9'];
Though above example doesn't work. Is there any easy
Jonathan M Davis:
auto r = chain(uiota('a', 'z'), uiota('A', 'Z'), uiota('0',
'9'));
Those ranges are probably open on the right.
In Bugzilla I have asked for the syntax iota![](a, b) to
change how the extrema are handled, modelled on
std.random.uniform syntax.
---
Kagamin:
On Thursday, 22 January 2015 at 18:23:00 UTC, Meta wrote:
Whoops, I forgot to make it a template to force CTFE.
import std.stdio;
template charRange(string spec)
{
static processInput(string spec)
{
import std.algorithm;
import std.ascii;
import std.conv;
Jonathan M Davis:
but that's easy fixed with some +1's.
But the +1 changes the char to an int.
Bye,
bearophile
On Thursday, January 22, 2015 10:42:59 bearophile via Digitalmars-d-learn wrote:
Jonathan M Davis:
auto r = chain(uiota('a', 'z'), uiota('A', 'Z'), uiota('0',
'9'));
Those ranges are probably open on the right.
They probably are actually, since open on the right is usually how things
are
On 22.01.15 20:05, Meta wrote:
On Thursday, 22 January 2015 at 19:00:47 UTC, zeljkog wrote:
On 22.01.15 19:26, Meta wrote:
On Thursday, 22 January 2015 at 18:23:00 UTC, Meta wrote:
Whoops, I forgot to make it a template to force CTFE.
You can force CTFE assigning to manifest constant.
enum
On Thursday, 22 January 2015 at 19:12:32 UTC, zeljkog wrote:
On 22.01.15 20:05, Meta wrote:
On Thursday, 22 January 2015 at 19:00:47 UTC, zeljkog wrote:
On 22.01.15 19:26, Meta wrote:
On Thursday, 22 January 2015 at 18:23:00 UTC, Meta wrote:
Whoops, I forgot to make it a template to force
On 22.01.15 19:26, Meta wrote:
On Thursday, 22 January 2015 at 18:23:00 UTC, Meta wrote:
Whoops, I forgot to make it a template to force CTFE.
You can force CTFE assigning to manifest constant.
enum t = charRange!...
On Thursday, 22 January 2015 at 19:00:47 UTC, zeljkog wrote:
On 22.01.15 19:26, Meta wrote:
On Thursday, 22 January 2015 at 18:23:00 UTC, Meta wrote:
Whoops, I forgot to make it a template to force CTFE.
You can force CTFE assigning to manifest constant.
enum t = charRange!...
By wrapping
On Thursday, 22 January 2015 at 19:13:46 UTC, Meta wrote:
On Thursday, 22 January 2015 at 19:12:32 UTC, zeljkog wrote:
On 22.01.15 20:05, Meta wrote:
On Thursday, 22 January 2015 at 19:00:47 UTC, zeljkog wrote:
On 22.01.15 19:26, Meta wrote:
On Thursday, 22 January 2015 at 18:23:00 UTC, Meta
On Thursday, January 22, 2015 15:16:07 bearophile via Digitalmars-d-learn wrote:
Jonathan M Davis:
but that's easy fixed with some +1's.
But the +1 changes the char to an int.
True, though iota doesn't seem to like to operate on char anyway, so from
the little playing around with it I did
On Thursday, 22 January 2015 at 17:45:59 UTC, tcak wrote:
So, at the end of the day (I left working on my Matcher class
in the morning waiting an answer for this question), there is
nothing to convert ['a'..'d', '0'..'3'] to ['a', 'b', 'c', 'd',
'0', '1', '2', '3'] at compile time
On Thursday, 22 January 2015 at 17:15:34 UTC, Jonathan M Davis
via Digitalmars-d-learn wrote:
On Thursday, January 22, 2015 15:16:07 bearophile via
Digitalmars-d-learn wrote:
Jonathan M Davis:
but that's easy fixed with some +1's.
But the +1 changes the char to an int.
True, though iota
tcak:
So, at the end of the day (I left working on my Matcher class
in the morning waiting an answer for this question), there is
nothing to convert ['a'..'d', '0'..'3'] to ['a', 'b', 'c', 'd',
'0', '1', '2', '3'] at compile time automatically.
Right. The 'a'..'d' is not first class, and
I want to define alphanumeric characters in an easy way.
Something like that:
char[] arr = ['a'..'z', 'A'..'Z', '0'..'9'];
Though above example doesn't work. Is there any easy way to do
this?
I am trying to do something like EBNF definitions. So, I do not
want to use loops, or define every
On Thursday, 22 January 2015 at 05:56:40 UTC, tcak wrote:
I want to define alphanumeric characters in an easy way.
Something like that:
char[] arr = ['a'..'z', 'A'..'Z', '0'..'9'];
Though above example doesn't work. Is there any easy way to do
this?
I am trying to do something like EBNF
On Thursday, 22 January 2015 at 05:56:40 UTC, tcak wrote:
I want to define alphanumeric characters in an easy way.
Something like that:
char[] arr = ['a'..'z', 'A'..'Z', '0'..'9'];
Though above example doesn't work. Is there any easy way to do
this?
I am trying to do something like EBNF
19 matches
Mail list logo