On 2013-08-29 22:02, Andrej Mitrovic wrote:
However it does work for local imports (I think this was new in 2.063):
void main()
{
import std.range;
assert([].empty); // ok
}
"empty" is declared at module scope.
--
/Jacob Carlborg
Is there a better way to express a range with stride than this:
foreach (i; iota(0, N, 2))
Maybe something similar to F# syntax:
foreach (i; 0..2..N)
I found this thread suggesting syntax improvement
http://forum.dlang.org/thread/bug-411...@http.d.puremagic.com/issues/
but I don't think it p
On 08/29/2013 08:53 PM, Meta wrote:
> However, after some fiddling, it seems that this is actually not
usable with
> anonymous functions, or at least, I couldn't find a way to do it.
Borrowing the "self" trick from the existing solution, the following
satisfies all of the requirements:
int
On Thursday, 29 August 2013 at 22:01:38 UTC, H. S. Teoh wrote:
That's clever, but I'm not sure I understand the bit about
anonymous functions? You don't need anonymous functions to have
recursion.
Sorry, that came out all wrong. What I meant was that it's neat
to be able to do anonymous recur
On 08/29/2013 05:20 AM, Andrej Mitrovic wrote:
> The emplace docs state that the chunk where to store the class object
> instance needs to be aligned to the class type alignment. But it
> doesn't say much on how to get this alignment from a class (we could
> add a note about using the classInstan
On 08/29/2013 06:58 AM, d coder wrote:> Greetings
>
> I have a question on class destructor method. D documentation for
> destructors says:
>
> "The garbage collector is not guaranteed to run the destructor for
> all unreferenced objects. Furthermore, the order in which the
garbage
>
On 08/29/2013 04:37 PM, bearophile wrote:
> H. S. Teoh:
>
>> Also, this is a pretty poor algorithm for generating the Fibonacci
>> series,
>
> I know, but you must do what the tasks asks you:
>
> http://rosettacode.org/wiki/Anonymous_recursion
>
> Bye,
> bearophile
Hm... Like some of the other l
On Fri, Aug 30, 2013 at 01:37:39AM +0200, bearophile wrote:
> H. S. Teoh:
>
> >Also, this is a pretty poor algorithm for generating the Fibonacci
> >series,
>
> I know, but you must do what the tasks asks you:
>
> http://rosettacode.org/wiki/Anonymous_recursion
[...]
OK I see.
I wish we could
H. S. Teoh:
Also, this is a pretty poor algorithm for generating the
Fibonacci series,
I know, but you must do what the tasks asks you:
http://rosettacode.org/wiki/Anonymous_recursion
Bye,
bearophile
On Thu, Aug 29, 2013 at 03:00:09PM -0700, H. S. Teoh wrote:
> On Thu, Aug 29, 2013 at 11:00:49PM +0200, Robik wrote:
> > On Thursday, 29 August 2013 at 18:57:58 UTC, Meta wrote:
> > >uint fib(in uint n) pure nothrow {
> > >immutable self = &__traits(parent, {});
> > >return (n < 2) ? n : se
On Thu, Aug 29, 2013 at 11:00:49PM +0200, Robik wrote:
> On Thursday, 29 August 2013 at 18:57:58 UTC, Meta wrote:
> >uint fib(in uint n) pure nothrow {
> >immutable self = &__traits(parent, {});
> >return (n < 2) ? n : self(n - 1) + self(n - 2);
> >}
> >
> >I came across this while browsing
On Thursday, 29 August 2013 at 21:06:04 UTC, Rory McGuire wrote:
Hi all,
I've got this little ctfe template function that checks if a
function called member with first argument T exists. Its for
checking if a type has a custom encoder.
bool hasUFCSmember(T, string member)() {
T v;
/
Hi all,
I've got this little ctfe template function that checks if a
function called member with first argument T exists. Its for
checking if a type has a custom encoder.
bool hasUFCSmember(T, string member)() {
T v;
// would be nice if we could use ParameterTypeTuple to get the
fir
On Thursday, 29 August 2013 at 18:57:58 UTC, Meta wrote:
uint fib(in uint n) pure nothrow {
immutable self = &__traits(parent, {});
return (n < 2) ? n : self(n - 1) + self(n - 2);
}
I came across this while browsing Rosetta Code. It's really
cool how you can do recursion without anonymo
On 8/29/13, Jacob Carlborg wrote:
> UFCS only works for module level functions.
However it does work for local imports (I think this was new in 2.063):
void main()
{
import std.range;
assert([].empty); // ok
}
On Wednesday, 28 August 2013 at 21:28:11 UTC, bioinfornatics
wrote:
Hi everyone,
yesterday i read an article into a french linux journal that in
some years garbage collector will disapear.
Why ? he explain in very very short as:
--
- Moore's law will be not anymore tru
On 2013-08-29 16:20, qznc wrote:
Also, be careful about the problem domain. There will be enough domains
left in some years, where garbage collection is the better tradeoff.
Just think about all the domains where Python,Ruby,etc are popular now.
The interesting field is mobile, though. Android's
uint fib(in uint n) pure nothrow {
immutable self = &__traits(parent, {});
return (n < 2) ? n : self(n - 1) + self(n - 2);
}
I came across this while browsing Rosetta Code. It's really cool
how you can do recursion without anonymous functions (and this
will actually not work if you make
On Thursday, 29 August 2013 at 06:23:32 UTC, Jacob Carlborg wrote:
UFCS only works for module level functions.
What is the reason for this limitation?
On Thu, Aug 29, 2013 at 01:46:03AM +0200, Marek Janukowicz wrote:
> H. S. Teoh wrote:
>
> > On Thu, Aug 29, 2013 at 12:45:05AM +0200, Marek Janukowicz wrote:
> >> H. S. Teoh wrote:
> > [...]
> >> > Oh, and BTW, are you on Linux 32-bit or 64-bit? Don't know if
> >> > that makes a difference, but ju
On Wednesday, 28 August 2013 at 21:28:11 UTC, bioinfornatics
wrote:
Hi everyone,
yesterday i read an article into a french linux journal that in
some years garbage collector will disapear.
Why ? he explain in very very short as:
--
- Moore's law will be not anymore tru
Greetings
I have a question on class destructor method. D documentation for
destructors says:
"The garbage collector is not guaranteed to run the destructor for
all unreferenced objects. Furthermore, the order in which the garbage
collector calls destructors for unreference ob
On 16/08/13 23:21, JS wrote:
You can't get them both at the same time though, which you might just make _A
final.
The whole point of inheritance is to treat derived classes as if they were base
classes.
Sorry for delayed response here, I've been fairly heavily focused on other
things. :-(
I
On 2013-08-29, 10:25, Jonathan M Davis wrote:
On Thursday, August 29, 2013 10:07:31 Paul Jurczak wrote:
On Thursday, 29 August 2013 at 07:51:40 UTC, Jonathan M Davis
wrote:
[..]
> as any integral value in a float will fit in an
> int.
[..]
Will it? Most of them will not fit
Sure, they will
A little related:
http://d.puremagic.com/issues/show_bug.cgi?id=8873
Bye,
bearophile
The emplace docs state that the chunk where to store the class object
instance needs to be aligned to the class type alignment. But it
doesn't say much on how to get this alignment from a class (we could
add a note about using the classInstanceAlignment template), or even
how to use it to create e.
On Thursday, 29 August 2013 at 08:58:02 UTC, Paul Jurczak wrote:
On Thursday, 29 August 2013 at 08:26:11 UTC, Jonathan M Davis
wrote:
On Thursday, August 29, 2013 10:07:31 Paul Jurczak wrote:
On Thursday, 29 August 2013 at 07:51:40 UTC, Jonathan M Davis
wrote:
[..]
> as any integral value in a
On Thursday, 29 August 2013 at 08:26:11 UTC, Jonathan M Davis
wrote:
On Thursday, August 29, 2013 10:07:31 Paul Jurczak wrote:
On Thursday, 29 August 2013 at 07:51:40 UTC, Jonathan M Davis
wrote:
[..]
> as any integral value in a float will fit in an
> int.
[..]
Will it? Most of them will not
On Thursday, 29 August 2013 at 08:26:11 UTC, Jonathan M Davis
wrote:
On Thursday, August 29, 2013 10:07:31 Paul Jurczak wrote:
On Thursday, 29 August 2013 at 07:51:40 UTC, Jonathan M Davis
wrote:
[..]
> as any integral value in a float will fit in an
> int.
[..]
Will it? Most of them will not
On Thursday, August 29, 2013 10:07:31 Paul Jurczak wrote:
> On Thursday, 29 August 2013 at 07:51:40 UTC, Jonathan M Davis
> wrote:
> [..]
>
> > as any integral value in a float will fit in an
> > int.
>
> [..]
>
> Will it? Most of them will not fit
Sure, they will. float has 32 bits, just like
On Thursday, 29 August 2013 at 07:51:40 UTC, Jonathan M Davis
wrote:
[..]
as any integral value in a float will fit in an
int.
[..]
Will it? Most of them will not fit, but cast to int produces
nonsensical value anyway as in this example:
cast(int)float.max
With to!int you get a proper warn
On Thursday, August 29, 2013 08:50:47 Paul Jurczak wrote:
> On Thursday, 29 August 2013 at 06:23:18 UTC, Jonathan M Davis
>
> wrote:
> > On Thursday, August 29, 2013 07:47:16 Paul Jurczak wrote:
> >> I'm writing this rather ugly:
> >>
> >> sqrt(cast(float)D) != round(sqrt(cast(float)D)
> >>
> >>
32 matches
Mail list logo