On Saturday, 12 September 2015 at 12:51:04 UTC, Namal wrote:
Anyway, there is no .reverse for strings I guess, what is the
way to completely reverse a string in D?
What do you want to do? Do you want to keep your data in original
order, but get a reversed view of it for something, or do you
a
On 9/12/15 10:48 PM, Prudence wrote:
It would seem to be the logical thing to do?
That is, suppose two threads are sharing a resource. Thread A has it
locked. B is "waiting". Is B in a loop burning cycles running in the
background(regardless of thread.sleep, which only alleviates the
problem) or
It would seem to be the logical thing to do?
That is, suppose two threads are sharing a resource. Thread A has
it locked. B is "waiting". Is B in a loop burning cycles running
in the background(regardless of thread.sleep, which only
alleviates the problem) or does it yield completely and someh
On Saturday, 12 September 2015 at 10:17:19 UTC, Nordlöw wrote:
How do I most elegantly iterate all the adjacent pairs in an
`InputRange` using Phobos?
Something like
[1,2,3,4] => [(1,2), (2,3), (3,4)]
Why not just:
zip(arr[0 .. $-1], arr[1 .. $])
?
On Saturday, 12 September 2015 at 20:05:28 UTC, rcorre wrote:
After upgrading from DMD 2.068.0-1 to DMD 2.068.1-1, my project
began producing a large linker error (when built using dub).
I was able to trace it down to a single line:
target = target.adjacent(Diagonals.yes).randomSample(1).front
On Saturday, 12 September 2015 at 13:42:44 UTC, Prudence wrote:
Saying that it doesn't use it most of the time is not an
answer/solution. Using it at all is a problem because one
doesn't know when and where. I realize there is a switch
now(-vgc), and maybe that is the solution, but you say "wel
On Saturday, 12 September 2015 at 13:42:44 UTC, Prudence wrote:
Using it at all is a problem because one doesn't know when and
where.
It is called when the collect function is called and where it was
called from.
D's garbage collector isn't magic, it is just a function that
frees memory whe
On Saturday, 12 September 2015 at 22:36:00 UTC, Laeeth Isharc
wrote:
Thank you for this. How large is the allocation for closure
for a delegate? Just a pair of pointers?
It depends on what the delegate needs to capture. It makes a copy
of the local variables the function is referencing. (Usu
On Saturday, 12 September 2015 at 06:23:12 UTC, Jonathan M
Davis wrote:
Aside from the few classes in Phobos, its GC usage is almost
entirely restricted to when it allocates arrays or when it has
to allocate a closure for a delegate, which can happen in some
cases when passing predicates to ran
On 09/12/2015 02:29 PM, Marco Leise wrote:
> Note that often the original dynamic array has additional
> capacity beyond its length. This can be used to ~= additional
> items without causing a reallocation, but is lost when you
> do the assignment "b = a".
Actually, the capacity is still there,
On Saturday, 12 September 2015 at 09:03:53 UTC, Russel Winder
wrote:
Once you get to a GtkD application bigger than "Hello World"
create a project and use Dub.
Oh yes, Dub. That's the ticket. Thanks, mate.
After upgrading from DMD 2.068.0-1 to DMD 2.068.1-1, my project
began producing a large linker error (when built using dub).
I was able to trace it down to a single line:
target = target.adjacent(Diagonals.yes).randomSample(1).front;
target is of type RowCol
(https://github.com/rcorre/dtiled/
Am Sat, 12 Sep 2015 10:55:50 +
schrieb "Namal" :
> > Why is also b flipped here? This doesn't happen if I use static
> > arrays.
>
> nvm. I need to .dup that.
Correct, static arrays are value types and copied on
assignment. Dynamic arrays on the other hand are generally
slices of memory on
On Saturday 12 September 2015 20:28, Random D user wrote:
> prints (with option B):
> bar: 0.00, 0.00 // BUG??
> baz: 1.00, 2.00
Looks like a bug to me. Please file an issue at https://issues.dlang.org/
On Saturday, 12 September 2015 at 18:28:02 UTC, Random D user
wrote:
or is it some obscure feature conflict?
[...]
Oh... and I'm using win 64-bit and dmd 2.068.1, but this behavior
was present earlier than that...
or is it some obscure feature conflict?
struct Foo
{
this( float x_, float y_ )
{
// option A
//x = x_;
//y = y_;
// option B
v[0] = x_;
v[1] = y_;
}
union
{
struct
{
float x = 0;
float y
On Saturday, 12 September 2015 at 18:20:37 UTC, Brad Roberts
wrote:
You can get away with it in some circumstances, but it's at
your own risk.
Yeah, I agree.
On Saturday 12 September 2015 19:36, Prudence wrote:
> On Saturday, 12 September 2015 at 17:11:04 UTC, anonymous wrote:
[...]
>> class MyStore
>> {
>> class SingleStore
>> {
>> static void New() // Removing 'static' compiles
>> {
>> new SingleStore();
>>
On 9/12/15 9:20 AM, Adam D. Ruppe via Digitalmars-d-learn wrote:
On Saturday, 12 September 2015 at 09:47:55 UTC, Jacob Carlborg wrote:
Well, if your D function doesn't use anything of the runtime I guess it's not
necessary.
Right. If you don't call into the threading system in the druntime, y
On Saturday, 12 September 2015 at 17:11:04 UTC, anonymous wrote:
On Saturday 12 September 2015 16:30, Ali Çehreli wrote:
Reduced:
[...]
Error: type SingleStore is not an expression
Reduced further:
class MyStore
{
class SingleStore
{
static void New() // Removing 'stat
On Saturday 12 September 2015 16:30, Ali Çehreli wrote:
> Reduced:
[...]
> Error: type SingleStore is not an expression
Reduced further:
class MyStore
{
class SingleStore
{
static void New() // Removing 'static' compiles
{
new SingleStore();
}
On Saturday, 12 September 2015 at 14:30:16 UTC, Ali Çehreli wrote:
On 09/12/2015 06:37 AM, Prudence wrote:
Says the creating new SingleStore is not an expression
Reduced:
mixin template ObjectStore(TKey)
{
class SingleStore
{
static void New()// Removing 'static' compiles
On Saturday, 12 September 2015 at 14:41:45 UTC, Spacen Jasset
It appears that I can't put this in a module and import it
elsewhere to test the version specifications as they are all in
their own namespaces. Is this then a dead end for having a
feature configuration file?
Correct, version does
On Saturday, 12 September 2015 at 09:47:55 UTC, Jacob Carlborg
wrote:
Well, if your D function doesn't use anything of the runtime I
guess it's not necessary.
Right. If you don't call into the threading system in the
druntime, you should be ok. Keep in mind though that the GC uses
the threads
On Saturday, 12 September 2015 at 14:41:45 UTC, Spacen Jasset
wrote:
If I say this in one module:
version = current
version (Current) {
version = featurea;
version = featureb;
version = featurec;
}
It appears that I can't put this in a module and import it
elsewhere to test the versi
If I say this in one module:
version = current
version (Current) {
version = featurea;
version = featureb;
version = featurec;
}
It appears that I can't put this in a module and import it
elsewhere to test the version specifications as they are all in
their own namespaces. Is this th
On 09/12/2015 06:37 AM, Prudence wrote:
Says the creating new SingleStore is not an expression
Reduced:
mixin template ObjectStore(TKey)
{
class SingleStore
{
static void New()// Removing 'static' compiles
{
new SingleStore();
}
}
}
class M
On Saturday, 12 September 2015 at 06:23:12 UTC, Jonathan M Davis
wrote:
On Friday, September 11, 2015 23:29:05 Laeeth Isharc via
Digitalmars-d-learn wrote:
On Friday, 11 September 2015 at 21:58:28 UTC, Adam D. Ruppe
wrote:
> [...]
Seems to be quite a lot of FUD wrt use of standard library and
The following code simply does not work, it might be buggy now
after fiddling with it but basically remove and the
SingleStore.New are not working(Says the creating new SingleStore
is not an expression, which makes no sense to me).
Essentially I'm creating a mixin template so I can have dif
On Monday, 7 September 2015 at 10:28:20 UTC, deed wrote:
On Monday, 7 September 2015 at 10:25:09 UTC, deed wrote:
writeln(x);// or you can pass it to a function.
I meant `writeln(x + 5)`
If I have just red your post before I started using reverse on
dynamic arrays...
Anyway, there is no
On Saturday, 12 September 2015 at 08:22:03 UTC, NX wrote:
What if I told you, you should search the official reference
before asking such things in the forum?
Searching is kinda hard, so I encourage people to ask if
something doesn't come up quickly. And then we need to be sure to
always answ
On Saturday, 12 September 2015 at 11:46:55 UTC, Nordlöw wrote:
I wrote my own as adjacentTuples and adjacentPairs:
https://github.com/nordlow/justd/blob/master/range_ex.d#L702
Note: No yet extended to N > 2.
An alternative naming would be overlappingTuples/Pairs.
Should this go into Phobos?
On Saturday, 12 September 2015 at 11:34:03 UTC, Bahman Movaqar
wrote:
On 09/12/2015 03:09 PM, "Nordlöw" wrote:
InputRange please, not RandomAccessRanges ;)
Oops! Here's one using only `InputRange` interface:
I wrote my own as adjacentTuples and adjacentPairs:
https://github.com/nordlow/jus
On 09/12/2015 04:04 PM, Bahman Movaqar wrote:
> Oops! Here's one using only `InputRange` interface:
I believe I need to warn you that I'm just learning D; so take my
solution at your own risk :-)
--
Bahman Movaqar
On 09/12/2015 03:09 PM, "Nordlöw" wrote:
> InputRange please, not RandomAccessRanges ;)
Oops! Here's one using only `InputRange` interface:
T[][] collate(T)(T[] a)
{
alias CollateResult = Tuple!(T[][], "result", T, "tlHd");
CollateResult _collate(CollateResult collres)
Why is also b flipped here? This doesn't happen if I use static
arrays.
nvm. I need to .dup that.
On Saturday, 12 September 2015 at 10:35:41 UTC, Bahman Movaqar
wrote:
On 09/12/2015 02:47 PM, "Nordlöw" wrote:
How do I most elegantly iterate all the adjacent pairs in an
`InputRange` using Phobos?
Something like
[1,2,3,4] => [(1,2), (2,3), (3,4)]
That's call `collate`ing IIRC.
A quick
On 09/12/2015 02:47 PM, "Nordlöw" wrote:
> How do I most elegantly iterate all the adjacent pairs in an
> `InputRange` using Phobos?
>
> Something like
>
> [1,2,3,4] => [(1,2), (2,3), (3,4)]
That's call `collate`ing IIRC.
A quick solution would be using `std.range.transposed`:
auto a = [1,2
import std.stdio;
void main(){
int [] a = [1,2,3,4,5];
int [] b = a;
writeln(b, " ", a);
a.reverse;
writeln(b, " ", a);
}
I get:
[1, 2, 3, 4, 5] [1, 2, 3, 4, 5]
[5, 4, 3, 2, 1] [5, 4, 3, 2, 1]
Why is also b flipped here? This doesn't happen if I use static
array
How do I most elegantly iterate all the adjacent pairs in an
`InputRange` using Phobos?
Something like
[1,2,3,4] => [(1,2), (2,3), (3,4)]
On 2015-09-12 10:56, Russel Winder via Digitalmars-d-learn wrote:
I have a small D function (C linkage) compiled to a shared object that
I am calling from Python via CFFI that works fine with no D runtime
initialization. Thus I have experimental evidence "always" is not
entirely the case! I real
On 09/12/2015 12:52 PM, NX wrote:
> What if I told you, you should search the official reference before
> asking such things in the forum?
I did search the net for terms such as "d lang back quoted string" or "d
lang multi line string" or "d lang string interpolation" before asking here.
However t
On Sat, 2015-09-12 at 06:58 +, Mike McKee via Digitalmars-d-learn
wrote:
[…]
> I just tested and you are correct. Now, is there a way that I can
> edit /etc/dmd.conf and make it so that I don't need to do this
> pkg-config stuff all the time?
I think editing /etc/dmd.conf would be the wrong
On Fri, 2015-09-11 at 21:50 +0200, Jacob Carlborg via Digitalmars-d
-learn wrote:
> On 2015-09-10 20:01, Russel Winder via Digitalmars-d-learn wrote:
> > Is there an easy way of knowing when you do not have to initialize
> > the
> > D runtime system to call D code from, in this case, Python via a C
On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar
wrote:
Is there any or they are just simply syntactically equivalent?
Are there any official docs on this?
What if I told you, you should search the official reference
before asking such things in the forum?
http://dlang.org/lex.
Is there any or they are just simply syntactically equivalent?
Are there any official docs on this?
--
Bahman Movaqar
http://BahmanM.com - https://twitter.com/bahman__m
https://github.com/bahmanm - https://gist.github.com/bahmanm
PGP Key ID: 0x6AB5BD68 (keyserver2.pgp.com)
signature.asc
Descr
On Friday, 11 September 2015 at 21:06:32 UTC, Ali Çehreli wrote:
On 09/11/2015 02:04 PM, Ali Çehreli wrote:
The same keyword has a different use with
templates:
And the official documentation:
http://dlang.org/template.html#TemplateAliasParameter
Thanks again!
On Friday, 11 September 2015 at 20:29:05 UTC, Mike Wey wrote:
You should be able to drop the -L-ldl and -I/usr/ flags, as
they are included in the pkg-config output.
I just tested and you are correct. Now, is there a way that I can
edit /etc/dmd.conf and make it so that I don't need to do
48 matches
Mail list logo