safety0ff:
Here's a candidate for
http://rosettacode.org/wiki/Extensible_prime_generator#D in
case it is preferred to the existing entry:
http://dpaste.dzfl.pl/43735da3f1d1
I was away. I have added your nice code with some small changes
as an alternative faster version. I think you have
On Tuesday, 12 February 2013 at 01:07:35 UTC, bearophile wrote:
In practice at the moment I am maintaining all the D entries of
Rosettacode.
Here's a candidate for
http://rosettacode.org/wiki/Extensible_prime_generator#D in case
it is preferred to the existing entry:
On Tuesday, 12 February 2013 at 01:07:35 UTC, bearophile wrote:
In practice at the moment I am maintaining all the D entries of
Rosettacode.
I modified the Hamming numbers code in a personal exercise.
It now uses considerably less memory but is slower.
I've posted the code here in case it
safety0ff:
I modified the Hamming numbers code in a personal exercise.
It now uses considerably less memory but is slower.
I've posted the code here in case it is of use:
http://dpaste.dzfl.pl/3990023e5577
For a single n, n = 350_000_000:
Alternative version 2: 13.4s and ~5480 MB of ram
My
Ali Çehreli:
Improve at will! :p
I will mostly just uniform its formatting to all the other
Rosettacode entries, shorten the lines to 72 chars, etc.
synchronized {
// Switch to the next printer
printers = printers[1..$];
On Wednesday, 26 February 2014 at 11:24:58 UTC, bearophile wrote:
Ali Çehreli:
synchronized {
// Switch to the next printer
printers = printers[1..$];
}
This doesn't work:
printers.popFront();
Yes, because
I forgot to note that both synchronized {} blocks should also be
synchronizing on the same mutex. Right now it's two different
critical sections, so a race is still possible, i.e. while one
thread is printing the other may be removing the first printer.
Run the code several times and you'll no
Stanislav Blinov:
You'd also have to synchronize access to id member,
I forgot to note that both synchronized {} blocks should also
be synchronizing on the same mutex.
The mutex could be emulated with a shared bool and
std.atomic.cas(). That would get rid of synchronized{} blocks
and
On Wednesday, 26 February 2014 at 12:58:26 UTC, bearophile wrote:
If you have bug fixes, or improvements, it's better to do them
right there. Of if you don't want to register on that site, you
can put the modified version in dpaste, and I'll upload it on
Rosettacode.
Here are some
On 02/26/2014 03:24 AM, bearophile wrote:
Ali Çehreli:
Improve at will! :p
I will mostly just uniform its formatting to all the other Rosettacode
entries, shorten the lines to 72 chars, etc.
synchronized {
// Switch to the next printer
Ali Çehreli:
And I am not sure why the slicing syntax works because the
'printers' member is still shared then.
Probably it's a known D implementation fault meant to be
eventually fixed.
-
Stanislav Blinov:
Here are some improvements:
http://dpaste.dzfl.pl/6430488f3d07
On 02/26/2014 04:46 AM, Stanislav Blinov wrote:
I forgot to note that both synchronized {} blocks should also be
synchronizing on the same mutex.
Oh, that's a good one! :)
Run the code several times and you'll no doubt stumble upon it.
But I had inserted that Sleep() in there. Isn't that
On 02/26/2014 06:58 AM, bearophile wrote:
Updated the site
http://rosettacode.org/wiki/Rendezvous#D
Thanks for posting the problem to begin with. I've learned a lot.
Ali
On Wednesday, 26 February 2014 at 14:54:05 UTC, Ali Çehreli wrote:
On 02/26/2014 03:24 AM, bearophile wrote:
Ali Çehreli:
Improve at will! :p
I will mostly just uniform its formatting to all the other
Rosettacode
entries, shorten the lines to 72 chars, etc.
synchronized
Stanislav Blinov:
The whole 'shared' concept being incomplete in the language is
a shame. Hopefully things will get better in the near future.
As for slicing syntax for shared arrays, personally I think it
should be disallowed, just like operators for shared scalars.
But that would mean
Thank you for posting the code. However, I think there might be a
subtle bug with my synchronization on bools, but I need to
comtemplate on it some more to be sure :)
On Wednesday, 26 February 2014 at 15:52:24 UTC, bearophile wrote:
Stanislav Blinov:
Oh, there is still much to discuss on
Is someone willing to write a D entry for this?
http://rosettacode.org/wiki/Rendezvous
Bye,
bearophile
On 02/25/2014 03:48 PM, bearophile wrote:
Is someone willing to write a D entry for this?
http://rosettacode.org/wiki/Rendezvous
Bye,
bearophile
I think the following satisfies the requirements. Improve at will! :p
import std.stdio;
import std.exception;
import std.array;
import
qznc:
This sounds somewhat paradox to me. How can a new feature have
a regression? A regression means it has worked before, but
new feature did not exist before.
Regressions on older betas; or to see if using the new features
breaks other apparently unrelated parts of old code.
In
I just made some scripts [0] to download and compile all D
examples from Rosettacode. From 186 of 716 examples fail to
compile [1]. Some for trivial reasons like not wrapped into a
main function or a missing import. Some require SDL or Tango or
other third-party libraries.
My ultimate goal
Brad Roberts:
I think this is a mistake. They should compile with a released
compiler.
Why? And why do you think that outweighs the several advantages
of having entries compilable only with the latest beta compiler?
(Currently there are 40-50 entries that don't compile with the
released
On 1/15/14 4:42 PM, bearophile wrote:
Brad Roberts:
I think this is a mistake. They should compile with a released compiler.
Why? And why do you think that outweighs the several advantages of having
entries compilable only
with the latest beta compiler?
(Currently there are 40-50 entries
Brad Roberts:
Requiring that users of the code in resottacode be using
bleeding edge, unreleased, compilers is a disservice to those
users. Typical users will not and should not need to use
anything other than a released compiler.
Some of the rosettacode usages/purposes are:
- Trying new
qznc:
[0]
https://bitbucket.org/qznc/rosetta/src/da12e3673b0d/compile_all/?at=master
[1] https://gist.github.com/qznc/9ba4b0e78abfc35d4694
Few of the tasks of your list were never updated to D2/Phobos,
and they should be updated.
Among the ones that are updated, I have found five that
arithmetic_evaluation.d
balanced_ternary.d
combinations_with_repetitions1.d
k_means_plus_plus_clustering.d
names_to_numbers.d or number_names.d
I have fixed them.
This is the problem in array, already in Bugzilla, I think it's a
kind of regression:
import std.array: array;
immutable foo =
On Thursday, 16 January 2014 at 01:11:23 UTC, bearophile wrote:
- To test the compiler betas to see if they have regressions
if you try to use the new features.
This sounds somewhat paradox to me. How can a new feature have a
regression? A regression means it has worked before, but new
This D1 entry needs an update:
http://rosettacode.org/wiki/Metered_concurrency#D
Is someone willing to update it?
import std.stdio, core.thread, std.c.time;
class Semaphore {
private int lockCnt, maxCnt;
this(in int count) {
maxCnt = lockCnt = count;
}
void acquire()
Jos van Uden:
It's an old task (from 2007). The task description was changed
after the D entries were made.
Yes, there are about 63 Rosettacode tasks that I have not yet
updated:
accumulator_factory.d
address_of_a_variable.d
animation.d
boolean_values.d
I have added a D entry for the Go Fish game:
http://rosettacode.org/wiki/Go_Fish#D
I don't know the Go Fish game, so I am not sure this code is
correct. Is some of you able and willing to test its play a bit?
(This D entry is very Python-style because it's a translation of
the Python entry,
the entry :
http://rosettacode.org/wiki/File_IO
is wrong because as stated by the asignment : In this task, the job is to
create a file called output.txt, and place in it the contents of the file
input.txt, *via an intermediate variable.***
*
*
there is no intermediate variable; I don't know if
On Saturday, 31 August 2013 at 01:42:43 UTC, bearophile wrote:
I have added a D entry for the Go Fish game:
hmm there's too much text output, it makes following the game
hard, and seeing what the computer drew means you can cheat!
But I think it plays correctly, I was able to finish a game.
On 31-8-2013 4:08, maarten van damme wrote:
the entry :
http://rosettacode.org/wiki/File_IO
is wrong because as stated by the asignment : In this task, the job is to create a file called
output.txt, and place in it the contents of the file input.txt, /via an intermediate
variable.///
/
/
there
This D entry uses Tango, but it should also show a version for
Phobos:
http://rosettacode.org/wiki/Rosetta_Code/Count_examples#D
Bye,
bearophile
This D entry uses Tango, but it should also show a version for
Phobos:
http://rosettacode.org/wiki/Rosetta_Code/Count_examples#D
Two versions
The Mathematica solution is short:
TaskList = Flatten[
Import[http://rosettacode.org/wiki/Category:Programming_Tasks;,
Data][[1, 1]]];
Now this D entry works again:
http://rosettacode.org/wiki/S-Expressions#D
Probably it can be written without explicit indexes, only using
txt.front, txt.popFrontN, txt.find, etc. Do you want to produce
such modified version?
This simple task shows well why a parser combinators like Parsec
This entry has stopped working since lot of time:
http://rosettacode.org/wiki/MD5/Implementation#D
This is an improved version, but help is welcome:
http://codepad.org/g4RBio8E
Bye,
bearophile
http://codepad.org/g4RBio8E
this line:
.replace(TT, 0x ~ text(T(n), 16));
Needs to be:
.replace(TT, 0x ~ to!string(T(n), 16));
But the code in that link is all wrong because it needs all the
code from std.md5 to work.
And even then I don't know where Decode() is.
Bye,
bearophile
But the code in that link is all wrong because it needs all the
code from std.md5 to work.
And even then I don't know where Decode() is.
OK, the code now works :-)
Bye,
bearophile
OK, the code now works :-)
And the results are a bit hilarious:
...md5_implementation5_dmd
md5 digest() = D41D8CD98F00B204E9800998ECF8427E
zmd5 digest() = D41D8CD98F00B204E9800998ECF8427E
Test performance / message size 200MBytes
digest(data) = F083432AB71F6177A8EC2CA5157F7B83
std.md5:
Am Sat, 22 Jun 2013 23:27:00 +0200
schrieb bearophile bearophileh...@lycos.com:
Ali Çehreli:
The code compiles under 32-bit (e.g. with the -m32 compiler
switch) where size_t is an alias of uint.
Oh, I see. I compile most of the code on a 32 bit system.
I asked Walter to warn d
Adam D. Ruppe:
code:
http://arsdnet.net/dcode/rpc-example.d
library:
https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/rpc.d
It's online:
http://rosettacode.org/wiki/Distributed_programming#D
Bye,
bearophile
On Saturday, 22 June 2013 at 21:27:01 UTC, bearophile wrote:
Ali Çehreli:
The code compiles under 32-bit (e.g. with the -m32 compiler
switch) where size_t is an alias of uint.
Thanks, Ali! I'm always compiling on 64 bit systems; I'll add the
32 bit switch to my diagnostic approach now.
On Saturday, 16 February 2013 at 11:30:00 UTC, Jos van Uden wrote:
On 16-2-2013 8:58, qznc wrote:
On Saturday, 16 February 2013 at 06:58:01 UTC, qznc wrote:
On Saturday, 16 February 2013 at 02:23:42 UTC, Jos van Uden
wrote:
On 5-2-2013 20:45, Jos van Uden wrote:
By the way, I think 'Qznc'
Brian Rogoff:
The current D code for Dining philosophers does not compile
with dmd v2.063.2, the error message being
dining.d(34): Error: cannot uniquely infer foreach argument
types
I try to keep the D entries on Rosettacode updated, but every dmd
release breaks tons of code, and
On 06/22/2013 11:53 AM, Brian Rogoff wrote:
The current D code for Dining philosophers does not compile with dmd
v2.063.2, the error message being
dining.d(34): Error: cannot uniquely infer foreach argument types
The code compiles under 32-bit (e.g. with the -m32 compiler switch)
where
Ali Çehreli:
The code compiles under 32-bit (e.g. with the -m32 compiler
switch) where size_t is an alias of uint.
Oh, I see. I compile most of the code on a 32 bit system.
I asked Walter to warn d programmers against such mistakes, and
Walter closed it down. Someone else has opened the ER
I asked Walter to warn d programmers against such mistakes, and
Walter closed it down. Someone else has opened the ER again...
I meant this:
http://d.puremagic.com/issues/show_bug.cgi?id=5063
In the meantime I have fixed the Rosettacode entry.
Bye,
bearophile
On 2013-06-18, 05:00, bearophile wrote:
With your code I have found a dmd compiler bug, are you able and willing
to further reduce this?
Tried this with 2.063.2, and there are three errors in the code -
deserializeInto
should return its buffer, the switch on line 19 needs a default: case,
Simen Kjaeraas:
Tried this with 2.063.2, and there are three errors in the code
- deserializeInto
should return its buffer, the switch on line 19 needs a
default: case, and
deserializeInto tries to modify its non-buffer argument (which
in this case is a
const string. None of these seem to be
On Tuesday, 18 June 2013 at 09:22:05 UTC, bearophile wrote:
third is the one that triggers a crash of my DMD version. I am
keeping my compiler updated, I have compiled it yesterday, and
it crashes after giving the error:
test.d(28): Error: cannot modify const expression s
Now I don't know if
Adam D. Ruppe:
I can't reproduce the compiler crash you saw though.
Thank you. Then it's somehow just my compiler...
Bye,
bearophile
Adam D. Ruppe:
and win the code golf every time! :P
Some Rosettacode D entries are a bit compressed, but that site is
not for code golfing. It's just preferred to not write long
programs, for several reasonable reasons.
code:
http://arsdnet.net/dcode/rpc-example.d
library:
I made a network server/client that needs no library except
Phobos. Came in a little under 500 lines but is quite generic:
http://arsdnet.net/dcode/server.d
The top of the file shows the usage program, then comes the code
that could go in a library.
Basically you define an interface with a
Adam D. Ruppe:
I made a network server/client that needs no library except
Phobos. Came in a little under 500 lines but is quite generic:
Normal Rosettacode entries are under 40-100 lines. Many entries
are about 10-20 lines long.
There are are few entries (in C or Ada) that reach 500
On Sunday, 16 June 2013 at 23:06:40 UTC, bearophile wrote:
Normal Rosettacode entries are under 40-100 lines. Many entries
are about 10-20 lines long.
I think that biases it toward giant standard libraries. I've
joked before that we could just say:
import rosettacode;
mixin Distributed!();
There is also one D entry in need to be fixed (with Phobos):
http://rosettacode.org/wiki/Distributed_programming#D
Bye,
bearophile
On Friday, 14 June 2013 at 22:17:16 UTC, bearophile wrote:
http://rosettacode.org/wiki/Distributed_programming#D
It kinda sounds like the description calls for something like
what web.d does:
server:
import arsd.web;
class Foo : ApiProvider {
export string hello(string name) { return
Adam D. Ruppe:
This actual example here uses several thousand lines of library
code but if you think it would fit the description, I'm sure I
can do a basic demo in far fewer lines using nothing but phobos.
I think Rosettacode accepts code that uses libraries that are
free. Take a look at
On Friday, 14 June 2013 at 22:44:40 UTC, bearophile wrote:
So if you think this task can be implemented quickly using
web.d, then use it :-)
I just think it is really cool that D can do that kind of thing,
so a brief implementation might be good to show people how it is
done.
I'll see
Adam D. Ruppe:
I'll see about slapping something together over the weekend and
posting it here.
If you use a library, please also give the link to the library,
so I can create a nearly empty page on Rosettacode about it. It's
kind of needed.
Bye,
bearophile
Some of the last ones that are undone still:
http://rosettacode.org/wiki/Birthday_problem
http://rosettacode.org/wiki/Suffix_tree
http://rosettacode.org/wiki/Deming%27s_Funnel
Bye,
bearophile
Maybe there is a way to translate this Haskell version to D with
bigints:
http://rosettacode.org/wiki/Find_largest_left_truncatable_prime_in_a_given_base#Haskell
Unrelated: now I have a kind of efficient longest common
subsequence algorithm with O(n) memory usage. Maybe there is some
Jos van Uden:
http://rosettacode.org/wiki/Set_puzzle#Alternative_Version
Ledrug tagged it. The output says: striped open open. That
shouldn't happen.
I don't know what's wrong, and why, so I've killed that
alternative version...
Bye,
bearophile
I you want to take a look, I've seen that my translation of the
Python entry was tagged as wrong:
http://rosettacode.org/wiki/Set_puzzle#Alternative_Version
Bye,
bearophile
On 5-4-2013 14:23, bearophile wrote:
I you want to take a look, I've seen that my translation of the Python entry
was tagged as wrong:
http://rosettacode.org/wiki/Set_puzzle#Alternative_Version
Ledrug tagged it. The output says: striped open open. That shouldn't happen.
Jos van Uden:
That shouldn't happen.
Do you know why that shouldn't happen? :-)
Bye,
bearophile
On 27-3-2013 0:20, bearophile wrote:
This task has just a Tango entry:
http://rosettacode.org/wiki/Concurrent_computing
So I am writing a Phobos version. This seems to work as requested:
import std.stdio, std.random, std.parallelism, core.thread, core.time;
void main() {
foreach (m;
On 27-3-2013 15:17, Jos van Uden wrote:
On 27-3-2013 0:20, bearophile wrote:
This task has just a Tango entry:
http://rosettacode.org/wiki/Concurrent_computing
So I am writing a Phobos version. This seems to work as requested:
import std.stdio, std.random, std.parallelism, core.thread,
Jos van Uden:
Output on my system:
C:\test
Rosetta
Enjoy
Code
C:\test
Code
Enjoy
Rosetta
Thank you for your test, I will replace the Rosettacode one with
the nicer version.
I don't know why the second doesn't work correctly on my system,
while the first works.
Bye,
bearophile
This task has just a Tango entry:
http://rosettacode.org/wiki/Concurrent_computing
So I am writing a Phobos version. This seems to work as requested:
import std.stdio, std.random, std.parallelism, core.thread,
core.time;
void main() {
foreach (m; [Enjoy, Rosetta, Code])
Some comments about the recently created Vampire number task in
Rosettacode:
The version I have modified:
http://rosettacode.org/mw/index.php?title=Vampire_numberdiff=154069oldid=154068
Fwend has reverted most of my changes:
http://rosettacode.org/wiki/Vampire_number#D
The
- Removal of if (auto factors = ...): coding standards
suggest to avoid mixing conditional tests with actions. Keeping
code more tidy is safer.
Also in D testing array emptiness like that is generally
dangerous. The idiomatic and correct way to do it in D is to use
empty. Because in general
A new version of Vampire number, do you like it?
http://codepad.org/DaVxWpoA
Bye,
bearophile
On 24-3-2013 21:02, bearophile wrote:
Some comments about the recently created Vampire number task in Rosettacode:
The version I have modified:
http://rosettacode.org/mw/index.php?title=Vampire_numberdiff=154069oldid=154068
Fwend has reverted most of my changes:
Jos van Uden:
I think it's convenient, it checks for null or empty, I don't
find it confusing at all.
I agree it's shorter and it looks handy. But one of its problems
is that in D there are arrays with length zero that aren't null:
import std.stdio;
int[] foo() {
auto a = [1];
In the vampire code this doesn't happen because you return null
(that is represented by two zero words), but in general unlike
Python in D the safe and idiomatic way to test for array
emptiness is to use std.array.empty. Otherwise you risk having
problems.
I have just opened a thread in the
On Tuesday, 19 March 2013 at 18:53:21 UTC, bearophile wrote:
Small changes on your version:
http://codepad.org/E9KHKvAi
It's now on Rosettacode. I have added more changes to make it
able to deal with immutable input.
Bye,
bearophile
Another issue to consider as the question I was
ixid:
The prime factorization of 1 is an empty set, so surely to be
correct it should return [] when given 1 and not throw an
exception.
The Task says that the input can't be 1, so the input 1 needs to
be a pre-condition violation:
Write a function which returns an array or collection
I was just looking at the Rosetta code for prime decomposition
and it seems bugged to me, wanted to make sure as you seem to be
the one coordinating these things:
http://rosettacode.org/wiki/Prime_decomposition#D
This will potentially return a 1 in the list of primes which is a
bug as 1
On Tuesday, 19 March 2013 at 15:55:19 UTC, ixid wrote:
I was just looking at the Rosetta code for prime decomposition
and it seems bugged to me, wanted to make sure as you seem to
be the one coordinating these things:
http://rosettacode.org/wiki/Prime_decomposition#D
This will potentially
ixid:
http://rosettacode.org/wiki/Prime_decomposition#D
This will potentially return a 1 in the list of primes which is
a bug as 1 isn't prime.
From Python code, hopefully more correct and much faster:
http://codepad.org/N4A7kxE1
Bye,
bearophile
On Tuesday, 19 March 2013 at 16:47:43 UTC, Andrea Fontana wrote:
On Tuesday, 19 March 2013 at 15:55:19 UTC, ixid wrote:
I was just looking at the Rosetta code for prime decomposition
and it seems bugged to me, wanted to make sure as you seem to
be the one coordinating these things:
On Tuesday, 19 March 2013 at 17:18:01 UTC, bearophile wrote:
ixid:
http://rosettacode.org/wiki/Prime_decomposition#D
This will potentially return a 1 in the list of primes which
is a bug as 1 isn't prime.
From Python code, hopefully more correct and much faster:
Small changes on your version:
http://codepad.org/E9KHKvAi
It's now on Rosettacode. I have added more changes to make it
able to deal with immutable input.
Bye,
bearophile
On 5-3-2013 2:05, bearophile wrote:
But if you fear that, then I've added private to all global identifiers:
http://rosettacode.org/wiki/Simple_database#D
I have removed private again, because it's bad to program compromises.
This is a complete program, it's not a module, and it's not
On 5-3-2013 11:45, Jos van Uden wrote:
On 5-3-2013 2:05, bearophile wrote:
But if you fear that, then I've added private to all global identifiers:
http://rosettacode.org/wiki/Simple_database#D
I have removed private again, because it's bad to program compromises.
This is a complete program,
Jos van Uden:
// this shouldn't happen
test.d
import simdb;
If I try to compile something like that my dmd gives me a
duplicated main error, or something similar.
I really mean:
test.d
void fun() {
auto db = load();
// etc
store(db);
}
simdb.d
import test;
fun();
On Tuesday, 5 March 2013 at 13:12:49 UTC, bearophile wrote:
Jos van Uden:
// this shouldn't happen
test.d
import simdb;
If I try to compile something like that my dmd gives me a
duplicated main error, or something similar.
Sorry, that was a wrong example.
I really mean:
test.d
void
Now and then this thread becomes very useful for some
coordination and discussion.
Regarding this Task:
http://rosettacode.org/wiki/Take_notes_on_the_command_line#D
Fwend has recently modified it with this note:
the file only needs to be created before append; filename can be
written as one
On 4-3-2013 23:04, bearophile wrote:
Now and then this thread becomes very useful for some coordination and
discussion.
Regarding this Task:
http://rosettacode.org/wiki/Take_notes_on_the_command_line#D
Fwend has recently modified it with this note:
the file only needs to be created before
On 5-3-2013 0:57, Jos van Uden wrote:
On 4-3-2013 23:04, bearophile wrote:
Now and then this thread becomes very useful for some coordination and
discussion.
Regarding this Task:
http://rosettacode.org/wiki/Take_notes_on_the_command_line#D
Fwend has recently modified it with this note:
the
Jos van Uden:
It depends on how you interpret it. The task describes two
actions:
display and append. The question is: does the last sentence
refer to
the append action or to both display and append. I choose to
think it
refers to the append action because that makes more sense.
OK.
- - -
Jos van Uden:
Another consideration, I just remembered, was that it avoided
creating global variables.
Right, that's important, but every rule should be followed with a
grain of salt.
First of all in this program there are no global variables, just
a global immutable, filename. Global
On 5-3-2013 1:20, bearophile wrote:
Jos van Uden:
It depends on how you interpret it. The task describes two actions:
display and append. The question is: does the last sentence refer to
the append action or to both display and append. I choose to think it
refers to the append action because
Jos van Uden:
but it doesn't feel right to have these
functions publicly accessible. It's a matter of good coding
practice.
If I import a module these functions are exposed.
I think you can't import this module, because it has a main().
But if you fear that, then I've added private to all
But if you fear that, then I've added private to all global
identifiers:
http://rosettacode.org/wiki/Simple_database#D
I have removed private again, because it's bad to program
compromises.
This is a complete program, it's not a module, and it's not
imported. No need for private things.
On 2013-02-26 15:10, bearophile wrote:
This third version is much simpler and it seems good enough for
Rosettacode:
http://codepad.org/YJjb1t91
Nice. Myself I'd add bits.reverse; after the N.iota.map..., because I'm more
used to a truth table where the left-most operands iterate the slowest.
On 2013-02-27 12:47, FG wrote:
On 2013-02-26 15:10, bearophile wrote:
This third version is much simpler and it seems good enough for
Rosettacode:
http://codepad.org/YJjb1t91
Nice. Myself I'd add bits.reverse; after the N.iota.map..., because I'm more
used to a truth table where the
A possible idea is to translate this last Python version to D:
http://rosettacode.org/wiki/Hamming_numbers#Cyclic_generator_method_.232.
- - - - - - - - - - - -
Another idea is to add a D version of Merge Sort that works with
just a Input Range (like a single linked list, as a SList):
Jos van Uden:
But I couldn't figure out how to expand the boolean array to
an argument list.
I wrote a version, it's more statically type safe, but the code
is quite hairy, and the foreach(i) generates too many templates
if the predicate has many bool arguments:
1 - 100 of 148 matches
Mail list logo