On Monday, 30 December 2013 at 21:15:43 UTC, Ilya Yaroshenko
wrote:
I want something like
enum factrorial5 = (a => a == 0 ? 1 : a * __lambda(a-1))(5);
//Recursive pure lambda function
That isn't supported in D. And cases where this would be useful
are too rare to add complexity to the languag
Use Y combinator?
http://forum.dlang.org/thread/mailman.157.1385247528.2552.digitalmars-d-le...@puremagic.com#post-l6rgfq:24g5o:241:40digitalmars.com
The solution is to append `line.dup` instead of `line`.
I guess this note in the documentation should be marked red:
Each front will not persist after popFront is called, so the
caller must copy its contents (e.g. by calling to!string) if
retention is needed.
On Wednesday, 25 December 2013 at 18:41:47 UTC, H. S. Teoh wrote:
import std.array : array;
import std.algorithm : joiner;
string joined = joiner(["hello", "world"], " ").array;
T
Ha!
Error: cannot implicitly convert expression
(array(joiner(["hello", "world"], " ")
Use std.range.cycle with std.container.Array (slice the array to
get a range).
http://dlang.org/phobos/std_range.html#.cycle
Yep. In 'before_install' download a D compiler and add it to
$PATH; in 'script' specify commands for running tests.
On Friday, 13 December 2013 at 18:03:28 UTC, Nikolay wrote:
Results:
~/ldc2-0.12.0-linux-x86_64/bin/ldmd2 -O -release -inline
zip_test.d
./zip_test --limit 1000
…
0 - 0
1 - 764
And now try -inline-threshold=1024 ;-)
Reading -help-hidden sometimes helps.
Did you install binaries or build the compiler from source?
On Monday, 2 December 2013 at 20:53:10 UTC, Namespace wrote:
But sadly named imports aren't private...
OMG now I get it why in 2.064 importing std.regex makes visible
std.uni.isWhite all of a sudden.
Why so much fuss about delegates? I would simply define an
interface.
// factory function for simple cases
queue.register(eventHandler((Event e) { ... }));
// here, 'this' is available
class SomeComplicatedHandler : IEventHandler { ... }
://github.com/lomereiter/kyoto-d/blob/master/kyotocabinet.d
Indeed, disassembly reveals an allocation (with all three
compilers => it's the front-end which generates this crap).
I guess the compiler incorrectly treats { node.value; } as a
delegate and copies the node to GC heap.
void foo() {
int* node = null;
enum mutable = __traits(compiles,
I thought about it once but quickly abandoned the idea. The
primary reason was that D doesn't have REPL and is thus not
suitable for interactive data exploration.
Thanks.
Now I realise that D is much less intuitive than C++.
I assume that you template ends up creating a dummy interface
though and this isn't really acceptable.
Yes, it does. Once ':' is typed, some inheritance must occur.
Why isn't a dummy interface acceptable?
On Sunday, 14 July 2013 at 05:04:37 UTC, JS wrote:
and while I'm at it I need to conditionally constrain types.
interface A(T) where(!isBasicType!T, (T : B));
which is suppose to require T to inherit from B if T is not
basic type.
interface A(T) if (isBasicType!T || is(T : B))
This should work:
template conditionallyInherit(bool inherit, T) {
static if (inherit)
alias T conditionallyInherit;
else
interface conditionallyInherit {}
}
This doesn't work when the method is marked as @property. Any
idea why is that so?
On Wednesday, 5 June 2013 at 02:19:38 UTC, Jonathan M Davis wrote:
is(typeof(A.func) == const)
- Jonathan M Davis
Current implementation of joiner accesses each element two times
- first, in a loop which skips empty ranges, plus after the loop
assignment to a variable occurs:
https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm.d#L2993
On Tuesday, 12 March 2013 at 17:51:57 UTC, Steph
Indeed, that shouldn't be the case. I filed a bug request:
http://d.puremagic.com/issues/show_bug.cgi?id=9661
While it isn't fixed, assign file to a variable so that it
doesn't go out of scope.
On Thursday, 7 March 2013 at 16:20:24 UTC, bioinfornatics wrote:
I only replace write by put and
The second is probably faster (with optimizations enabled),
because each call to writeln incurs overhead of locking/unlocking
the file stream (which is stdout in this case).
If you need to print huge amounts of data, use lockingTextWriter
like this:
auto w = stdout.lockingTextWriter;
foreach
I often search libraries on Github — it allows to filter results
by language, and probably most D libraries are anyway hosted
there.
22 matches
Mail list logo