On 19/03/12 15:45, H. S. Teoh wrote:
On Mon, Mar 19, 2012 at 08:50:02AM -0400, bearophile wrote:
James Miller:
writeln(v1 == 1); //false
writeln(v1 == 1.0); //false
writeln(v1 == 1.0f); //false
writeln(v1+1 == 2.0f); //true
Maybe I'd like to deprecate
On 19.03.2012 23:24, Jay Norwood wrote:
On Monday, 19 March 2012 at 13:55:39 UTC, Dmitry Olshansky wrote:
That's right, however counting is completely separate from regex,
you'd want to use std.algorithm count:
count(match(,\n));
or more unicode-friendly:
count(match(, regex($,m));
On Tuesday, 20 March 2012 at 10:28:11 UTC, Dmitry Olshansky wrote:
Note that if your task is to split buffer by exactly '\n' byte
then loop with memchr is about as fast as it gets, no amount of
magic compiler optimizations would make other generic ways
better (even theoretically). What they
I understand the point of lazy evaluation but I often want to use
the lazy algorithm library functions in an eager way. Other than
looping through them all which feels rather messy is there a good
way of doing this?
Is there a reason not to allow the following to be automatically
treated
On Tue, 20 Mar 2012 18:36:46 +0100, ixid nuacco...@gmail.com wrote:
I understand the point of lazy evaluation but I often want to use the
lazy algorithm library functions in an eager way. Other than looping
through them all which feels rather messy is there a good way of doing
this?
Is
simendsjo:
std.array includes a method, array(), for doing exactly this:
int[] test2 = array(map!a+a(test1)); //eager
With 2.059 you can write that also in a more readable way, because there is
less nesting:
int[] test2 = test1.map!q{a + a}().array();
Bye,
bearophile
Thanks, very handy!
On Tuesday, 20 March 2012 at 04:32:13 UTC, Adam D. Ruppe wrote:
I know very little about std.xml (I looked at it and
said 'meh' and wrote my own lib), but my lib
makes this pretty simple.
https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff
grab dom.d and
On 03/20/2012 10:50 AM, bearophile wrote:
simendsjo:
std.array includes a method, array(), for doing exactly this:
int[] test2 = array(map!a+a(test1)); //eager
With 2.059 you can write that also in a more readable way, because
there is less nesting:
int[] test2 = test1.map!q{a +
On Tue, Mar 20, 2012 at 02:52:05PM -0700, Ali Çehreli wrote:
[...]
By the way, is there a name for the = syntax?
[...]
You just named it. :-)
T
--
Real programmers can write assembly code in any language. :-) -- Larry Wall
On 03/20/2012 02:08 AM, Don Clugston wrote:
For starters, note that ANY integer expression which is exact, is also
exact in floating point.
With the note that the integer type has better precision at higher
values. For example, there are many 32-bit values that uint can, but
float cannot
On 21 March 2012 04:26, Jay Norwood j...@prismnet.com wrote:
yes, thanks. I read your other link and that was helpful. I think I
presumed that the escape handling was something belonging to stdio, while
regex would have its own valid escapes that would include \p. But I see now
that the
Hi all,
How to convert the following struct to D?
typedef struct S {
int type;
void *obj;
} S;
I didn't found anything at http://dlang.org/htomodule.html.
Ouch, void* is the same in both languages, sorry. I addressed a new problem:
typedef struct SomeFunctions {
void *(*funcA)(char*, size_t);
void *(*funcB)(void);
} SomeFunctions;
How do I convert that functions references into an D struct?
On Tue, Mar 20, 2012 at 3:01 PM, Pedro Lacerda
On 3/21/12, Pedro Lacerda kanvua...@gmail.com wrote:
Ouch, void* is the same in both languages, sorry. I addressed a new problem:
typedef struct SomeFunctions {
void *(*funcA)(char*, size_t);
void *(*funcB)(void);
} SomeFunctions;
How do I convert that functions references into an
Andrej Mitrovic:
extern(C)
struct SomeFunctions {
void function(char*, size_t) funcA;
void function() funcB;
}
Are you sure that works?
If that doesn't work then use this and write a bug report:
struct SomeFunctions {
extern(C) void function(char*, size_t) funcA;
extern(C)
On 3/21/12, bearophile bearophileh...@lycos.com wrote:
Are you sure that works?
It's easy to test:
extern(C)
struct SomeFunctions {
void function(char*, size_t) funcA;
void function() funcB;
}
void main()
{
writeln(typeof(SomeFunctions.funcA).stringof);
}
On Wednesday, 21 March 2012 at 01:09:58 UTC, Andrej Mitrovic
wrote:
On 3/21/12, Pedro Lacerda kanvua...@gmail.com wrote:
Ouch, void* is the same in both languages, sorry. I addressed
a new problem:
typedef struct SomeFunctions {
void *(*funcA)(char*, size_t);
void *(*funcB)(void);
}
On 3/21/12, Pedro Lacerda kanvua...@gmail.com wrote:
dnewbie, you're correct, the return type is void* instead of void.
I didn't notice the pointer thanks to the silly C function pointer syntax. :)
Andrej Mitrovic:
I didn't know that! Is this documented anywhere?
It's documented formally, but I see no usage examples of the
nested formatting syntax:
http://dlang.org/phobos/std_format.html
Bye,
bearophile
20 matches
Mail list logo