Compare the following two programs which take a string of whitespace separated
binary and decode it's message eg echo 01001101 01100101 01110010 01110010
0001 0010 0111 01101000 01110010 01101001 01110011 01110100
01101101 0111 01110011 0011 0011 0011 | ./main.d
doubleagent doubleagen...@gmail.com wrote:
The former works while the latter fails. It looks like there's some
manipulation of 'bytes' and 'list' when writefln forces evaluation. My
question is should this happen?
void main() {
immutable auto bytes = splitter(stdin.readln(), ' ');
Hello,
I need to test in sequence the bits of an unsigned int (see below more
precision), and move in a tree accordingly. Since there are 2 possible branches
at every step, they are encoded in a [2] array, indexed by bit. I am looking
for the fastest way to get that bit.
To run backwards (MSB
On 26/12/2010 12:18, spir wrote:
Hello,
I need to test in sequence
Denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com
http://digitalmars.com/d/2.0/phobos/std_intrinsic.html
--
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
spir denis.s...@gmail.com wrote:
Also, My actual need would rather be to move forward. The reason is this
allows important optimisations for common cases. In fact, the codes are
unicode code points: if the 5 first bits are 0 (tested with a mask), I
can jump forward to a sub-tree
On Sun, 26 Dec 2010 13:40:22 +0100
Simen kjaeraas simen.kja...@gmail.com wrote:
foreach (i ; 0..BIT_SIZE) {
mask = MASKS[i];
bit = !!(code mask);
node = node.nodes[bit];
}
But as you see masking that way lets a value of 2^i, not 1, in the
'true'
spir denis.s...@gmail.com wrote:
foreach ( i; 0..BIT_SIZE ) {
bit = ( code i ) 1;
node = node.nodes[bit];
}
You have not read my post carefully enough ;-) That's ~ how I coded
traversing the bit seq backwards (right-to-left, LSB - MSB); but I was
trying to find a way to
Hello,
If I have
class Node (Element) {...}
can I subtype it like with
class Leaf (Element) : Node (Element) {...}
or such?
Denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com
spir denis.s...@gmail.com wrote:
Hello,
If I have
class Node (Element) {...}
can I subtype it like with
class Leaf (Element) : Node (Element) {...}
or such?
Yes.
--
Simen
On 12/26/2010 05:47 PM, spir wrote:
Hello,
If I have
class Node (Element) {...}
can I subtype it like with
class Leaf (Element) : Node (Element) {...}
or such?
Denis
Absolutely:
class Leaf(Element) : Node!Element {...}
Stanislav Blinov stanislav.bli...@gmail.com wrote:
On 12/26/2010 05:47 PM, spir wrote:
Hello,
If I have
class Node (Element) {...}
can I subtype it like with
class Leaf (Element) : Node (Element) {...}
or such?
Denis
Absolutely:
class Leaf(Element) : Node!Element {...}
On Sun, 26 Dec 2010 17:54:22 +0300
Stanislav Blinov stanislav.bli...@gmail.com wrote:
Hello,
If I have
class Node (Element) {...}
can I subtype it like with
class Leaf (Element) : Node (Element) {...}
or such?
Denis
Absolutely:
class Leaf(Element) : Node!Element
Hi, I don't know if it's the right place for this, I prefer forums to
newsgroups. Anyway, I am learning D and trying to work with associative arrays.
Code (I'm using v1.065 of the DMD compiler):
int[char[]] arr;
if (foo in arr)
{
};
if (foo !in arr) // if (!(foo in arr)) obviously
Jacek Nowak:
Hi, I don't know if it's the right place for this, I prefer forums to
newsgroups.
This is the right place. And I think you need to get used to the newsgroups.
There is also the IRC #D channel.
now, according to http://digitalmars.com/d/1.0/expression.html
The !in expression
Works in D2, but not in D1. Perhaps this is only a D2 feature?
On 12/26/10, Jacek Nowak jacekno...@wp.eu wrote:
Hi, I don't know if it's the right place for this, I prefer forums to
newsgroups. Anyway, I am learning D and trying to work with associative
arrays.
Code (I'm using v1.065 of the
Thank you bearophile and Simen for your replies! Very helpful!
I'll keep looking into it...
BR
/HF
bearophile Wrote:
Simen kjaeraas:
Essentially, mark the switch as final, and cover every option.
Likely, the optimizer does that for you if you cover every option but
don't mark the
Hey guys,
I've the following class:
abstract class Drawable {
public {
uint getHeight() { ... }
uint getWidth() { ... }
abstract {
void draw(T = void*)(uint zPos, T obj = null);
}
}
}
I think this is relevant:
http://www.digitalmars.com/d/2.0/template.html : Limitations:
Templates cannot be used to add non-static members or virtual
functions to classes.
Templates cannot add functions to interfaces.
But I'm a little confused as to how it all works out. This will work:
import
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article
Also note that auto is unnecessary when another storage class is
specified (const,immutable).
Ah, that's right!
There have been several asking for tail-const (i.e. const(int)[])
support for ranges other than arrays. I have even
Ah, okay - remove override is enough.
Thanks :)
doubleagent doubleagen...@gmail.com wrote:
There have been several asking for tail-const (i.e. const(int)[])
support for ranges other than arrays. I have even written an
implementation that to an extent works, but more language support would
be preferable.
That seems like a really important
On Friday 24 December 2010 22:49:37 Heywood Floyd wrote:
Quick 2.051 D for Xcode fix:
Open
/Library/Application Support/Developer/Shared/Xcode/Plug-ins/
And do Show contents on the 'D for Xcode.xcplugin-bundle and then open
./Contents/Resources/dmd2.pblinkspec
and change the line
I just figured out that this doesn't work, when I use a array with
super class as base type, for example: Drawable[] textures;
Then, I'll get the following error:
Error: function draw!(void*).draw non-virtual functions cannot be
abstract.
I just implemented the draw-function as empty function,
On 12/21/2010 07:38 PM, Andrej Mitrovic wrote:
I found this by accident:
import std.stdio;
import std.conv;
void main()
{
writeln(to!string(2, 2)); // writes 10
writeln(to!string(1, 0)); // std.conv.ConvException: Radix error
}
I'm not sure why std.conv.to would even take multiple
Nrgyzer nrgy...@gmail.com wrote:
I just figured out that this doesn't work, when I use a array with
super class as base type, for example: Drawable[] textures;
Then, I'll get the following error:
Error: function draw!(void*).draw non-virtual functions cannot be
abstract.
I just implemented
On 12/27/10, Simen kjaeraas simen.kja...@gmail.com wrote:
Yes indeed. This was what I meant by saying that template functions
cannot be virtual. D sadly has no way to create templated functions
that work in a class hierarchy. :(
Does it really make sense for a class to have methods that
On Sunday 26 December 2010 16:18:19 Simen kjaeraas wrote:
Andrej Mitrovic andrej.mitrov...@gmail.com wrote:
Does it really make sense for a class to have methods that accept any
type of argument? It's one thing to have a class specialized on some
type(s), e.g.:
class Foo(T1, T2)
{
Jonathan M Davis jmdavisp...@gmx.com wrote:
A big problem with having template functions be virtual is the fact that
such
functions don't exist until they're called, whereas a class and its
virtual
function need to exist regardless of whether the functions get called -
particularly when you
Hi, guys. — said the shy newcomer.
I've started reading The D Programming Language just yesterday and I'm
making my first attempts to dig into D now. I must say I'm loving the
language beyond recognition. I never thought there was a language out there
that had everything I ever wanted in C++ (I
The sense is that I have different, drawable classes/object - for
example a simple texture (not clickable) and a button (clickable).
When the user clicks the mouse, the obj-param which is defined by
using draw!(T = void*)(uint zPos, T obj = null) will be saved in a
template-struct which should
30 matches
Mail list logo