On 2-4-2014 15:38, Denis Mezhov wrote:
On Wednesday, 2 April 2014 at 12:51:57 UTC, bearophile wrote:
Denis Mezhov:
How to out unicode cyrillic string to console?
Try this command on the command line:
chcp 65001
Bye,
bearophile
chcp 65001 dont'work
start.bat
mode con cols=150 lines=50
On 31-3-2014 19:50, Jeroen Bollen wrote:
I am trying to foreach over a std.container.DList but it isn't working. I have
tried the following code: https://gist.github.com/Binero/f30e56351baf05f1a2ec
I am getting the following errors:
/usr/include/dlang/dmd/std/container.d(1925): Error:
On 24-9-2013 11:26, Chris wrote:
On Thursday, 19 September 2013 at 18:44:54 UTC, Jos van Uden wrote:
On 19-9-2013 17:18, Chris wrote:
Short question in case anyone knows the answer straight away:
How do I sort text so that non-ascii characters like á are treated in the same way as
a?
Now
On 19-9-2013 17:18, Chris wrote:
Short question in case anyone knows the answer straight away:
How do I sort text so that non-ascii characters like á are treated in the same way as
a?
Now I'm getting this:
[wow, ara, ába, marca]
=== sort(listAbove);
[ara, marca, wow, ába]
I'd like to get:
On 1-9-2013 16:11, Adam D. Ruppe wrote:
On Sunday, 1 September 2013 at 14:07:00 UTC, Flamaros wrote:
Is there a simple way to extract from a string all Unicode codes as uint values?
string foo = whatever;
foreach(dchar ch; foo) {
// ch is the code point as a 32 bit number
// use it
On 30-8-2013 0:40, H. S. Teoh wrote:
(...)
A far better implementation is to use std.range.recurrence:
uint fib(in uint n) pure nothrow {
return recurrence!((a,n) = a[n-2] + a[n-1])(1, 1)
.drop(n-1)
.front;
}
This
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
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.
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
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:
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
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
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
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
On 1-3-2013 10:03, thedeemon wrote:
On Thursday, 28 February 2013 at 09:35:03 UTC, rho wrote:
hi,
what keeps me from using d, is that there is no compilable gui lib available.
does dfl compile with the latest dmd?
I am using DFL successfully with DMD 2.062. One just needs to take sources
On Tuesday, 26 February 2013 at 14:10:04 UTC, bearophile wrote:
With functions like this my last version will become simpler,
and it's equally statically type safe:
bool xor(in bool[2] args) pure nothrow {
return b[0] != b[1];
}
This third version is much simpler and it seems good enough
On 25-2-2013 22:54, bearophile wrote:
You have recently added:
http://rosettacode.org/wiki/Parse_command-line_arguments#D
http://rosettacode.org/wiki/Old_Russian_measure_of_length#D
http://rosettacode.org/wiki/Truth_table#D
Yes.
But maybe there is one more Task you have recently added that
On 26-2-2013 5:19, bearophile wrote:
http://rosettacode.org/wiki/Truth_table#D
Some changes:
http://codepad.org/PEZWmrHG
But it's not good enough yet :-) Maybe there are ways to produce a D version
closed to the Go one.
I would have prefered to write:
bool xor(in bool A, in bool B) pure
Somebody added an incorrect notice to the D entry for Dijkstra's algorithm.
http://rosettacode.org/mw/index.php?title=Dijkstra%27s_algorithmdiff=nextoldid=147068
The chirality of the given output on Langtons ant doesn't match what
the code produces. (That's because somebody changed it a while ago).
See also the talk page.
http://rosettacode.org/wiki/Langton%27s_ant#D
On 16-2-2013 3:34, bearophile wrote:
A first revision, do you like the toString?
http://codepad.org/qhH2XpMx
It's fine, but we need another write at the end of run otherwise the final state
doesn't get written.
The modified code contains still an enum that gets converted to char and then
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' may want to have a look at 'The dining
philosophers':
http
On 16-2-2013 18:23, bearophile wrote:
The version you have put in Rosettacode is good, I have just added some missing
tests at the beginning
of the UTM constructor.
I added that precondition reluctantly, that's why its short :-). I really feel
that
input validation should be done elsewhere.
On 16-2-2013 19:55, bearophile wrote:
There is a way to make the D code faster: prepending a cell in left() is a slow
operation:
void right() pure nothrow {
this.position++;
if (this.position == this.tape.length)
this.tape ~= this.blank;
}
void left() pure nothrow {
if
On 5-2-2013 23:44, bearophile wrote:
Jos van Uden:
Partial translation of the universal_turing_machine-Ruby:
http://codepad.org/nUXLzAg2
I'd have to first read up on the subject.
It's a simple task, just to implement an universal Turing machine. It's a
matter of finding a balance between
On 5-2-2013 20:45, Jos van Uden wrote:
By the way, I think 'Qznc' may want to have a look at 'The dining
philosophers':
http://rosettacode.org/wiki/Dining_philosophers
On 10-2-2013 1:57, bearophile wrote:
...
Partial translation of rcrpg-Python:
http://codepad.org/SflrKqbT
I have the rcrpg working, but I want to test it some more. I'm not very happy
with the alias function, it accepts just about any input, it can put the program
in an invalid state.
There
On 10-2-2013 7:14, Simon wrote:
Hi, I'm new to the D programming language. Overall I'm liking
things very much, but I'm still getting the hang of a few things.
Here's a basic programming pattern: I have a class called Thing,
and while I'm coding I decide I need N Thing instances.
In C++
On 9-2-2013 23:14, SomeDude wrote:
codepad.org doesn't work at all here. Maybe you should use dpaste (or pastebin
for other languages) instead ?
It's not working for me either. It's probably a temporary problem. It worked
fine before.
On 5-2-2013 0:55, bearophile wrote:
Is the Fwend user of Rosettacode (or some other interested person) around here?
I have written partial D implementations
for three tasks, maybe a little of coordination will speedup the work:
http://rosettacode.org/wiki/Permutations/Rank_of_a_permutation
On 5-2-2013 21:10, bearophile wrote:
How do we avoid working on the same thing?
Partial translation of rcrpg-Python:
http://codepad.org/SflrKqbT
Partial translation of permutations_rank_of_a_permutation-Python:
http://codepad.org/El9SQwOE
The 2 above, I could try.
Plus a better Perl
On 6-2-2013 1:33, bearophile wrote:
Maybe this line:
https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm.d#L9237
for (; !ahead.empty; ahead.popFront(), ++i)
Should be:
for (; !ahead.empty; ahead.popFront(), r.popFront(), ++i)
Thought that line
On 14-3-2012 0:14, Timon Gehr wrote:
I don't think there is, but I think I can create one:
! // 1 template instantiation
= // 2 goesto, binds weaker to the right
. ++ -- ( [ // 3 postfix operators
^^ // 4 power (right-associative)
++ -- * - + ! ~ // 5 prefix operators
* / % // 6 multiplicative
I've been reading the tutorial on templates and found this example:
template rank(T) {
static if (is(T t == U[], U)) // is T an array of U, for some type U?
enum rank = 1 + rank!(U); // then let’s recurse down.
else
enum rank = 0; // Base case, ending the recursion.
}
On 29-2-2012 7:06, James Miller wrote:
On 29 February 2012 18:51, jiccabr...@wrc.xerox.com wrote:
Greetings!
I have this program,
import std.process : system;
import std.stdio;
int main(char[][] args)
{
char[] cmd;
for (int i=1;iargs.length;i++)
{
cmd ~= args[i] ~ ;
}
On 8-2-2012 2:36, Timon Gehr wrote:
char[] is handled by Phobos as a range of dchar, ergo it does not have
swappable elements.
I'm surprised that array.reverse does work (using 2.057)
On 14-7-2011 5:48, Dr.Smith wrote:
import std.socket, std.string;
void main() {
Socket listener = new TcpSocket;
assert(listener.isAlive);
listener.bind(new InternetAddress(8080));
listener.listen(10);
string webpage = index.html;
Socket currSock;
uint
Using 2.053 on win32 (XP), compiles and runs.
Jacob Carlborg Wrote:
It works with dmd 1.045
Where to get it?
I also tried compiling derelict today. I finally managed to get past the error
messages by using the dmd compiler that ships with tango. 1.033 if I remember
correctly. The lib folder filled up nicely with files. Then I did a dsss
Spacen Jasset Wrote:
Jos van Uden wrote:
Jacob Carlborg Wrote:
On 8/16/09 19:36, Jos van Uden wrote:
Jacob Carlborg Wrote:
It works with dmd 1.045
Where to get it?
http://www.digitalmars.com/d/1.0/changelog.html#new1_045
Thank you. This version does indeed compile the libs
I noticed that I don't always have to use the bang notation for
function templates. I played around with that a little, but got
an error when I used a static array. I think it's because of a
casting problem or wrong type inference... I don't imagine it's
a bug. Just not possible.
module test;
bearophile wrote:
And a more general note Jos van Uden: don't use D2, it's unfinished, things
don't work yet. Use a stable version of D1, like 1.042.
Bye,
bearophile
I'm not using the language. Just trying to learn it. Most code
examples I see, require D2.
Jos
Oliver wrote:
The source code for the standard library comes with the compiler.
If you look in std\array.d, you find this around line 279 (reflowed for
readability):
void put(T, E)(ref T[] a, E e) {
assert(a.length);
a[0] = e; a = a[1 .. $];
}
Would anybody care to explain what this
Daniel Keep wrote:
No; read the code. Before the put, a and b are pointing to the same
span of memory. a.put(5) puts the value 5 into the front (first
element) of the array, then advances the array.
However, put can't see b, so it doesn't get updated along with a. The
end result is that b =
47 matches
Mail list logo