Re: Recursive lambda functions?

2013-12-30 Thread lomereiter
Use Y combinator? http://forum.dlang.org/thread/mailman.157.1385247528.2552.digitalmars-d-le...@puremagic.com#post-l6rgfq:24g5o:241:40digitalmars.com

Re: Recursive lambda functions?

2013-12-30 Thread lomereiter
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

Re: Reading file by line, weird result

2013-12-27 Thread lomereiter
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.

Re: joiner correct usage

2013-12-25 Thread lomereiter
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], ))) of type

Re: Circular Buffer

2013-12-20 Thread lomereiter
Use std.range.cycle with std.container.Array (slice the array to get a range). http://dlang.org/phobos/std_range.html#.cycle

Re: Travis-CI and D

2013-12-15 Thread lomereiter
Yep. In 'before_install' download a D compiler and add it to $PATH; in 'script' specify commands for running tests.

Re: Performance of ranges verses direct

2013-12-13 Thread lomereiter
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.

Re: How to install dmd2 in centos 5.3 x64

2013-12-03 Thread lomereiter
Did you install binaries or build the compiler from source?

Re: Is anything private by default when declared in a module?

2013-12-02 Thread lomereiter
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.

Re: How to make delegate refer to itself?

2013-11-23 Thread lomereiter
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 { ... }

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-15 Thread lomereiter
://github.com/lomereiter/kyoto-d/blob/master/kyotocabinet.d

Re: spurious gc allocation

2013-11-09 Thread lomereiter
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,

Re: D language manipulation of dataframe type structures

2013-09-24 Thread lomereiter
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.

Re: Conditional Inheritance

2013-07-15 Thread lomereiter
Thanks. Now I realise that D is much less intuitive than C++.

Re: Conditional Inheritance

2013-07-14 Thread lomereiter
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?

Re: Conditional Inheritance

2013-07-13 Thread lomereiter
This should work: template conditionallyInherit(bool inherit, T) { static if (inherit) alias T conditionallyInherit; else interface conditionallyInherit {} }

Re: Conditional Inheritance

2013-07-13 Thread lomereiter
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))

Re: how to reflect on function attributes

2013-06-05 Thread lomereiter
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

Re: joiner and map, strange behavior

2013-03-12 Thread lomereiter
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,

Re: question when writing to a file

2013-03-07 Thread lomereiter
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

Re: Googling about D

2012-12-18 Thread lomereiter
I often search libraries on Github — it allows to filter results by language, and probably most D libraries are anyway hosted there.