On Friday, 21 March 2014 at 00:56:22 UTC, Etienne wrote:
I'm trying to store a copy of strings for long-running
processes with malloc. I tried using emplace but the copy gets
deleted by the GC. Any idea why?
Could you show the snippet where you used "emplace"? I'd like to
know how you are usi
On Friday, 21 March 2014 at 00:31:58 UTC, bearophile wrote:
This is a somewhat common little exercise: Write a function
Bye,
bearophile
I like that replicate but easier for me to keep track of the
counts if I work from the center.
int blanks[];
blanks.length = n;
int stars[];
stars.length
On Wednesday, 19 March 2014 at 00:13:10 UTC, bearophile wrote:
A problem (that is not a regression) is that taskPool.amap
doesn't seem able to accept a lambda for some reason.
The reason for that is that any function in D currently can have
at most one context pointer. For class and struct met
On 03/20/2014 02:25 PM, Ali Çehreli wrote:
Write a function that takes
the size of a diamond and produces a diamond of that size.
I have learned a lot, especially the following two:
1) chain'ing iotas is an effective way of producing non-monotonic number
intervals (and more).
2) There is s
On 2014-03-20 21:46, Etienne Cimon wrote:
On 2014-03-20 21:08, Adam D. Ruppe wrote:
On Friday, 21 March 2014 at 00:56:22 UTC, Etienne wrote:
I tried using emplace but the copy gets deleted by the GC. Any idea why?
That's extremely unlikely, the GC doesn't know how to free manually
allocated t
On 2014-03-20 21:08, Adam D. Ruppe wrote:
On Friday, 21 March 2014 at 00:56:22 UTC, Etienne wrote:
I tried using emplace but the copy gets deleted by the GC. Any idea why?
That's extremely unlikely, the GC doesn't know how to free manually
allocated things. Are you sure that's where the crash
On Friday, 21 March 2014 at 00:56:22 UTC, Etienne wrote:
I tried using emplace but the copy gets deleted by the GC. Any
idea why?
That's extremely unlikely, the GC doesn't know how to free
manually allocated things. Are you sure that's where the crash
happens?
Taking a really quick look at
On 2014-03-20 8:39 PM, bearophile wrote:
Etienne:
I'm running some tests on a cache store where I planned to use only
Malloc for the values being stored, I'm hoping to eliminate the GC in
95% of the program, but to keep it only for actively used items..
Usually 95%-100% of a D program uses th
Etienne:
I'm running some tests on a cache store where I planned to use
only Malloc for the values being stored, I'm hoping to
eliminate the GC in 95% of the program, but to keep it only for
actively used items..
Usually 95%-100% of a D program uses the GC and the 0%-5% uses
malloc :-)
By
Ali Çehreli:
This is a somewhat common little exercise: Write a function
that takes the size of a diamond and produces a diamond of that
size.
When printed, here is the output for size 11:
*
***
*
***
*
***
*
***
*
***
*
On Thursday, 20 March 2014 at 22:46:53 UTC, Ali Çehreli wrote:
On 03/20/2014 03:03 PM, Brad Anderson wrote:
> I'm not entirely happy with it but:
I am not happy with my attempt either. :)
>void main()
>{
> import std.algorithm, std.range, std.stdio, std.conv;
>
> enum length
On 03/20/2014 03:48 PM, Timon Gehr wrote:
On 03/20/2014 10:25 PM, Ali Çehreli wrote:
This is a somewhat common little exercise: Write a function that takes
the size of a diamond and produces a diamond of that size.
When printed, here is the output for size 11:
*
***
*
***
On 03/20/2014 02:52 PM, Chris Williams wrote:
On Thursday, 20 March 2014 at 21:25:03 UTC, Ali Çehreli wrote:
What interesting, boring, efficient, slow, etc. ways are there?
Ali
Well one of the more convoluted methods that I can think of would be to
define a square as a set of four vectors, ro
On 03/20/2014 10:25 PM, Ali Çehreli wrote:
This is a somewhat common little exercise: Write a function that takes
the size of a diamond and produces a diamond of that size.
When printed, here is the output for size 11:
*
***
*
***
*
***
*
On 03/20/2014 03:03 PM, Brad Anderson wrote:
> I'm not entirely happy with it but:
I am not happy with my attempt either. :)
>void main()
>{
> import std.algorithm, std.range, std.stdio, std.conv;
>
> enum length = 5;
> auto rng =
> chain(iota(length), iota(length
On Thursday, 20 March 2014 at 20:48:18 UTC, Etienne wrote:
I'm running some tests on a cache store where I planned to use
only Malloc for the values being stored, I'm hoping to
eliminate the GC in 95% of the program, but to keep it only for
actively used items..
My problem is: when the progra
On Thursday, 20 March 2014 at 21:25:03 UTC, Ali Çehreli wrote:
What interesting, boring, efficient, slow, etc. ways are there?
Ali
I'd be interested in seeing a solution using "iota", and the
currently proposed "each" or "tee". A quick protype to draw a
triangle would be:
iota(0, n).each!(
On Thursday, 20 March 2014 at 21:25:03 UTC, Ali Çehreli wrote:
This is a somewhat common little exercise: Write a function
that takes the size of a diamond and produces a diamond of that
size.
When printed, here is the output for size 11:
*
***
*
***
*
*
On Thursday, 20 March 2014 at 21:25:03 UTC, Ali Çehreli wrote:
What interesting, boring, efficient, slow, etc. ways are there?
Ali
Well one of the more convoluted methods that I can think of would
be to define a square as a set of four vectors, rotate 45
degrees, and then create a rasterizer
On 03/20/2014 02:30 PM, Justin Whear wrote:
> What's the appropriate output for an even number?
Great question! :) Size must be odd. I have this in my function:
enforce(size % 2,
format("Size cannot be an even number. (%s)", size));
Ali
On Thu, 20 Mar 2014 14:25:02 -0700, Ali Çehreli wrote:
> This is a somewhat common little exercise: Write a function that takes
> the size of a diamond and produces a diamond of that size.
>
> When printed, here is the output for size 11:
>
> *
> ***
> *
>***
> *
This is a somewhat common little exercise: Write a function that takes
the size of a diamond and produces a diamond of that size.
When printed, here is the output for size 11:
*
***
*
***
*
***
*
***
*
***
*
What interesting
I'm running some tests on a cache store where I planned to use only
Malloc for the values being stored, I'm hoping to eliminate the GC in
95% of the program, but to keep it only for actively used items..
My problem is: when the program reaches 40MB it suddenly goes down to
0.9MB and blocks.
On Thursday, 20 March 2014 at 19:38:25 UTC, Chris wrote:
On Thursday, 20 March 2014 at 18:54:30 UTC, John Colvin wrote:
On Thursday, 20 March 2014 at 18:39:32 UTC, Chris wrote:
On Thursday, 20 March 2014 at 17:49:52 UTC, John Colvin wrote:
On Thursday, 20 March 2014 at 16:40:50 UTC, Chris wrot
On 2014-03-20 2:47 PM, H. S. Teoh wrote:
On Thu, Mar 20, 2014 at 06:39:10PM +, Chris Williams wrote:
On Thursday, 20 March 2014 at 18:06:18 UTC, Etienne wrote:
Right, I was assuming it was always ordered, but modern processor
pipelines are different I guess.
Even without rearranging the o
On Thursday, 20 March 2014 at 19:38:25 UTC, Chris wrote:
I thought the array T[] traits could hold any _type_ the
template Trait is instantiated into. That's where I got it
wrong.
This is the best explanation for this restriction that I can
think of:
struct Person(T)
{
static if (is(T =
>
>
>>
> I thought the array T[] traits could hold any _type_ the template Trait is
> instantiated into.
Different instantiations of a template could become totally unrelated types
(heck, even things that are *not* types: function definitions, values, code
blocks, ...). So there is now way for an
On Thursday, 20 March 2014 at 18:54:30 UTC, John Colvin wrote:
On Thursday, 20 March 2014 at 18:39:32 UTC, Chris wrote:
On Thursday, 20 March 2014 at 17:49:52 UTC, John Colvin wrote:
On Thursday, 20 March 2014 at 16:40:50 UTC, Chris wrote:
On Thursday, 20 March 2014 at 16:32:34 UTC, Vladimir
P
On Thursday, 20 March 2014 at 18:39:32 UTC, Chris wrote:
On Thursday, 20 March 2014 at 17:49:52 UTC, John Colvin wrote:
On Thursday, 20 March 2014 at 16:40:50 UTC, Chris wrote:
On Thursday, 20 March 2014 at 16:32:34 UTC, Vladimir
Panteleev wrote:
On Thursday, 20 March 2014 at 16:28:46 UTC, Chr
On Thu, Mar 20, 2014 at 06:39:10PM +, Chris Williams wrote:
> On Thursday, 20 March 2014 at 18:06:18 UTC, Etienne wrote:
> >Right, I was assuming it was always ordered, but modern processor
> >pipelines are different I guess.
>
> Even without rearranging the order of your code, your bit exists
On Thursday, 20 March 2014 at 17:49:52 UTC, John Colvin wrote:
On Thursday, 20 March 2014 at 16:40:50 UTC, Chris wrote:
On Thursday, 20 March 2014 at 16:32:34 UTC, Vladimir Panteleev
wrote:
On Thursday, 20 March 2014 at 16:28:46 UTC, Chris wrote:
How can I instantiate Person with Trait, i.e. a
On Thursday, 20 March 2014 at 18:06:18 UTC, Etienne wrote:
Right, I was assuming it was always ordered, but modern
processor pipelines are different I guess.
Even without rearranging the order of your code, your bit exists
in RAM but all the logic takes place in a CPU register, meaning
that a
On 2014-03-20 1:58 PM, John Colvin wrote:
Also, atomicity is not a strong enough guarantee for implementing a
mutex, which is what I assume you are trying to do. You need ordering
guarantees as well.
Heh. Will do!
On 2014-03-20 1:52 PM, Steven Schveighoffer wrote:
On Thu, 20 Mar 2014 13:43:58 -0400, Etienne wrote:
I'd like to "cowboy it" on an AA that looks like this:
__gshared bool[string] m_mutex;
I think it'll be much faster for my code because this AA could need to
be checked and switched possibly
Or make trait a class, storing the interface and passing the
trait to the new Person in the constructor.
On Thursday, 20 March 2014 at 17:43:58 UTC, Etienne wrote:
I'd like to "cowboy it" on an AA that looks like this:
__gshared bool[string] m_mutex;
I think it'll be much faster for my code because this AA could
need to be checked and switched possibly millions of times per
second and I wouldn't
On Thu, 20 Mar 2014 13:43:58 -0400, Etienne wrote:
I'd like to "cowboy it" on an AA that looks like this:
__gshared bool[string] m_mutex;
I think it'll be much faster for my code because this AA could need to
be checked and switched possibly millions of times per second and I
wouldn't wan
On Thursday, 20 March 2014 at 16:40:50 UTC, Chris wrote:
On Thursday, 20 March 2014 at 16:32:34 UTC, Vladimir Panteleev
wrote:
On Thursday, 20 March 2014 at 16:28:46 UTC, Chris wrote:
How can I instantiate Person with Trait, i.e. a template with
a template?
struct Trait(T0, T1) {
T0 name;
T1
I'd like to "cowboy it" on an AA that looks like this:
__gshared bool[string] m_mutex;
I think it'll be much faster for my code because this AA could need to
be checked and switched possibly millions of times per second and I
wouldn't want to slow it down with a mutex protecting it.
I'm thin
On Thursday, 20 March 2014 at 16:32:34 UTC, Vladimir Panteleev
wrote:
On Thursday, 20 March 2014 at 16:28:46 UTC, Chris wrote:
How can I instantiate Person with Trait, i.e. a template with
a template?
struct Trait(T0, T1) {
T0 name;
T1 value;
T1[T0] map;
this(T0 name, T1 value) {
this.
On Thursday, 20 March 2014 at 16:28:46 UTC, Chris wrote:
How can I instantiate Person with Trait, i.e. a template with a
template?
struct Trait(T0, T1) {
T0 name;
T1 value;
T1[T0] map;
this(T0 name, T1 value) {
this.name = name;
this.value = value;
map[name] = value;
}
}
On Thursday, 20 March 2014 at 16:28:46 UTC, Chris wrote:
How can I instantiate Person with Trait, i.e. a template with a
template?
struct Trait(T0, T1) {
T0 name;
T1 value;
T1[T0] map;
this(T0 name, T1 value) {
this.name = name;
this.value = value;
map[name] = value;
}
}
How can I instantiate Person with Trait, i.e. a template with a
template?
struct Trait(T0, T1) {
T0 name;
T1 value;
T1[T0] map;
this(T0 name, T1 value) {
this.name = name;
this.value = value;
map[name] = value;
}
}
class Person(T) {
T traits[];
void addTrait(T trait)
Am 14.03.2014 11:43, schrieb Chris:
[1]
Yesterday I tried to build a project with dub. dub had downloaded and
installed dmd v2.065. The project and accompanying library had been
built with dmd v2.064. dub said that the project was up to date and
didn't need compiling. However, I got a long long e
44 matches
Mail list logo