On Mon, 01 Aug 2011 21:43:13 +0200, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
Actually I don't really need *uniform* distribution, it's just that
when porting C code to D I didn't find any obvious random()/rnd()
functions, and uniform seemed to be the closest thing without having
to
I want to convert SomeChar[] or SomeChar* into
PerhapsAnotherCharNullTerminated*, but std.conv doesn't work like this.
char[] a = ao;
to!(wchar*)(a); // fails
toUTF16z converts char[] to wchar*
toStringz converts char[] to char*
Am I missing function(s), or do I have to combine them myself?
On Tuesday 02 August 2011 12:02:07 simendsjo wrote:
I want to convert SomeChar[] or SomeChar* into
PerhapsAnotherCharNullTerminated*, but std.conv doesn't work like this.
char[] a = ao;
to!(wchar*)(a); // fails
toUTF16z converts char[] to wchar*
toStringz converts char[] to char*
Am I
On 02-08-2011 05:20, Andrej Mitrovic wrote:
Maybe it's a framework for Farmville on Google Plus. :p
Then we must support it!
- Alex
On 02.08.2011 12:07, Jonathan M Davis wrote:
The github version has std.utf.toUTFz
Thanks, I'll try that.
What about the other way around? * to []?
On Tuesday 02 August 2011 12:15:00 simendsjo wrote:
On 02.08.2011 12:07, Jonathan M Davis wrote:
The github version has std.utf.toUTFz
Thanks, I'll try that.
What about the other way around? * to []?
I believe that it'll work with char* to string with std.conv.to, but I think
that's it at
The following program gives me
Error: template t.S.__ctor(C) if(isSomeChar!(C)) conflicts with
constructor t.S.this at t.d(4)
Is this because char etc can be converted to uint? Shouldn't the
template specification make this unambiguous?
import std.traits;
struct S {
this(uint i) {}
On 02.08.2011 12:27, Jonathan M Davis wrote:
On Tuesday 02 August 2011 12:15:00 simendsjo wrote:
On 02.08.2011 12:07, Jonathan M Davis wrote:
The github version has std.utf.toUTFz
Thanks, I'll try that.
What about the other way around? * to []?
I believe that it'll work with char* to
On 02.08.2011 15:06, simendsjo wrote:
The following program gives me
Error: template t.S.__ctor(C) if(isSomeChar!(C)) conflicts with
constructor t.S.this at t.d(4)
Is this because char etc can be converted to uint? Shouldn't the
template specification make this unambiguous?
import
import std.algorithm;
void main()
{
auto x = min([1, 2, 3]); // x would be 1
}
min() isn't equipped to do this on a single range. What can I use
instead? I haven't had my coffee yet. :)
On 8/2/11, Pelle pelle.mans...@gmail.com wrote:
Without UFCS, well, how would you want it to look?
Maybe..
auto max = 1024;
auto len = 1024;
arr = rndRange(max)[0..len];
IOW, using the slice operator instead of a call to array().
On 02.08.2011 13:55, Dmitry Olshansky wrote:
On 02.08.2011 15:06, simendsjo wrote:
The following program gives me
Error: template t.S.__ctor(C) if(isSomeChar!(C)) conflicts with
constructor t.S.this at t.d(4)
Is this because char etc can be converted to uint? Shouldn't the
template
On 02.08.2011 14:03, Andrej Mitrovic wrote:
import std.algorithm;
void main()
{
auto x = min([1, 2, 3]); // x would be 1
}
min() isn't equipped to do this on a single range. What can I use
instead? I haven't had my coffee yet. :)
import std.algorithm;
void main() {
assert(min(1,
On 02.08.2011 16:06, simendsjo wrote:
On 02.08.2011 13:55, Dmitry Olshansky wrote:
On 02.08.2011 15:06, simendsjo wrote:
The following program gives me
Error: template t.S.__ctor(C) if(isSomeChar!(C)) conflicts with
constructor t.S.this at t.d(4)
Is this because char etc can be converted to
On 02.08.2011 14:13, Dmitry Olshansky wrote:
On 02.08.2011 16:06, simendsjo wrote:
On 02.08.2011 13:55, Dmitry Olshansky wrote:
On 02.08.2011 15:06, simendsjo wrote:
The following program gives me
Error: template t.S.__ctor(C) if(isSomeChar!(C)) conflicts with
constructor t.S.this at t.d(4)
On 02.08.2011 16:08, Andrej Mitrovic wrote:
On 8/2/11, Pellepelle.mans...@gmail.com wrote:
Without UFCS, well, how would you want it to look?
Maybe..
auto max = 1024;
auto len = 1024;
arr = rndRange(max)[0..len];
IOW, using the slice operator instead of a call to array().
It could be done
Woops you're right about the range type being returned.
I guess this is the next best thing:
arr = array(rndRange(max, len));
On 02.08.2011 16:18, simendsjo wrote:
On 02.08.2011 14:13, Dmitry Olshansky wrote:
On 02.08.2011 16:06, simendsjo wrote:
On 02.08.2011 13:55, Dmitry Olshansky wrote:
On 02.08.2011 15:06, simendsjo wrote:
The following program gives me
Error: template t.S.__ctor(C) if(isSomeChar!(C))
On 8/2/11, simendsjo simend...@gmail.com wrote:
assert(reduce!min(a,b)([1,2,3]) == 1);
Thanks!
On 02.08.2011 14:22, Dmitry Olshansky wrote:
On 02.08.2011 16:18, simendsjo wrote:
On 02.08.2011 14:13, Dmitry Olshansky wrote:
On 02.08.2011 16:06, simendsjo wrote:
On 02.08.2011 13:55, Dmitry Olshansky wrote:
On 02.08.2011 15:06, simendsjo wrote:
The following program gives me
Error:
Does anyone know why putting this alias in module scope errors out?:
import std.algorithm;
alias reduce!((a, b){ return 1; }) foo;
void main()
{
foo([1, 2, 3]);
}
Error: delegate test.__dgliteral1!(int,int).__dgliteral1 is a nested
function and cannot
be accessed from reduce
But this will
On 02.08.2011 14:42, Andrej Mitrovic wrote:
Oh just realized I can use the much simpler:
auto x = reduce!(min)([1, 2, 3]);
Coffee is starting to kick in!
Of course. I even had a lot of coffee running through my veins, so shame
on me!
Andrej Mitrovic:
import std.algorithm;
void main()
{
auto x = min([1, 2, 3]); // x would be 1
}
min() isn't equipped to do this on a single range. What can I use
instead? I haven't had my coffee yet. :)
See:
http://d.puremagic.com/issues/show_bug.cgi?id=4705
Bye,
bearophile
Andrej Mitrovic:
Maybe..
auto max = 1024;
auto len = 1024;
arr = rndRange(max)[0..len];
In my opinion that's not general enough for Phobos, see the N dimensional
table() I have explained here:
auto arr = table!q{ uniform(0, 1024) }(1024);
On 02.08.2011 16:30, simendsjo wrote:
On 02.08.2011 14:22, Dmitry Olshansky wrote:
On 02.08.2011 16:18, simendsjo wrote:
On 02.08.2011 14:13, Dmitry Olshansky wrote:
On 02.08.2011 16:06, simendsjo wrote:
On 02.08.2011 13:55, Dmitry Olshansky wrote:
On 02.08.2011 15:06, simendsjo wrote:
The
On 8/2/11 6:42 AM, Jesse Phillips wrote:
auto arr = new int[1024];
fill(arr, randomCover(iota(0,1024), rndGen));
Note that this produces a random permutation of the numbers 0 to 1023,
which may or may not be what you want.
David
On 02.08.2011 15:25, Dmitry Olshansky wrote:
Most definitely a bug, you seem to hit a lot of 'em recently :)
Yeah :( The biggest reason I left D back in the days. Compiler bugs
whenever I did anything more than simple tests, and breaking changes
with each release so I had to change a lot of
On 02.08.2011 15:25, Dmitry Olshansky wrote:
On 02.08.2011 16:30, simendsjo wrote:
On 02.08.2011 14:22, Dmitry Olshansky wrote:
On 02.08.2011 16:18, simendsjo wrote:
On 02.08.2011 14:13, Dmitry Olshansky wrote:
On 02.08.2011 16:06, simendsjo wrote:
On 02.08.2011 13:55, Dmitry Olshansky
On 02.08.2011 14:22, Dmitry Olshansky wrote:
On 02.08.2011 16:18, simendsjo wrote:
On 02.08.2011 14:13, Dmitry Olshansky wrote:
On 02.08.2011 16:06, simendsjo wrote:
On 02.08.2011 13:55, Dmitry Olshansky wrote:
On 02.08.2011 15:06, simendsjo wrote:
The following program gives me
Error:
On Tuesday 02 August 2011 13:46:54 simendsjo wrote:
On 02.08.2011 12:27, Jonathan M Davis wrote:
On Tuesday 02 August 2011 12:15:00 simendsjo wrote:
On 02.08.2011 12:07, Jonathan M Davis wrote:
The github version has std.utf.toUTFz
Thanks, I'll try that.
What about the other way
I tried to convert a string into a wchar, but that didn't compile
because of this template constraint:
https://github.com/D-Programming-Language/phobos/blob/master/std/conv.d#L1770
Is there a way to convert a string into a wchar?
--
/Jacob Carlborg
I tried to convert a string into a wchar, but that didn't compile
because of this template constraint:
https://github.com/D-Programming-Language/phobos/blob/master/std/conv.d#L17
70
Is there a way to convert a string into a wchar?
Does that even make sense? What do you want it to do,
On 02.08.2011 16:18, simendsjo wrote:
On 02.08.2011 14:13, Dmitry Olshansky wrote:
On 02.08.2011 16:06, simendsjo wrote:
On 02.08.2011 13:55, Dmitry Olshansky wrote:
On 02.08.2011 15:06, simendsjo wrote:
The following program gives me
Error: template t.S.__ctor(C) if(isSomeChar!(C))
std.conv does not support conversion from a hexadecimal string to an
integer. Is there a technical reason for this limitation?
This is the best I could do, can it be improved still?
int i = to!int(parse!float(0x1ap0));
On 8/2/2011 8:17 PM, Stijn Herreman wrote:
std.conv does not support conversion from a hexadecimal string to an
integer. Is there a technical reason for this limitation?
This is the best I could do, can it be improved still?
int i = to!int(parse!float(0x1ap0));
parse!int(1a, 16);
35 matches
Mail list logo