On 01-Sep-10 12:54 PM, Andrej Mitrovic wrote:
Oooops, I meant:
std.stdio.StdioException: Bad file descriptor
type test.d | test.exe
works, but waits on exit:
test.exe | type test.d
works fine:
test.exe< test.d
I think I get the same as you. Have to put Ctrl+C (or some thing) to get
out, for
bearophile wrote:
This program doesn't compile, dmd prints the errors:
test.d(4): Error: template test.foo(T) does not match any function
template declaration
test.d(4): Error: template test.foo(T) cannot deduce template function
from argument types !()(const(int),int)
test.d(9): Error: te
On Wed, 01 Sep 2010 22:22:22 -0400, bearophile wrote:
> This program doesn't compile, dmd prints the errors: test.d(4): Error:
> template test.foo(T) does not match any function template declaration
> test.d(4): Error: template test.foo(T) cannot deduce template function
> from argument types !()(
// Original question by Peter Alexander is at http://stackoverflow.com/
questions/3627023/how-do-you-initialise-an-array-of-const-values-in-d2
to summarize consider this code:
const(int)[2] a;
const int [2] b;
const(int)[] c;
const int [] d;
void main () {
a = [1, 2]; // Error: slice a[] is no
Michal Minich wrote:
from high level point of view, there is difference in const(int)[2] and
const (int [2]). One would expect that it is possible to rebind b. From
low level/implementation point - there seems to be no difference because
a and b are value types - there is not indirection.
Poss
On 9/2/2010 5:59 AM, Simen kjaeraas wrote:
> bearophile wrote:
>
>> This program doesn't compile, dmd prints the errors:
>> test.d(4): Error: template test.foo(T) does not match any function template
>> declaration
>> test.d(4): Error: template test.foo(T) cannot deduce template function from
>>
On Thu, 02 Sep 2010 11:11:52 -0700, Brad Roberts wrote:
> On 9/2/2010 5:59 AM, Simen kjaeraas wrote:
>> void bar(T)(const T x, out T y) {}
>>
>> void main() {
>> const int s1;
>> int s2;
>> bar(s1, s2);
>> }
>>
>> It seems DMD is confused by const(int) being such a nice fit for the
>
Brad Roberts:
> http://d.puremagic.com/issues/show_bug.cgi?id=4594
Thanks for all the answers.
Bye,
bearophile
http://stackoverflow.com/questions/2553522/interview-question-check-if-one-string-is-a-rotation-of-other-string
I created a solution, but I don't want D to look bad, so I won't post
it. It's a bit for loop heavy...
At least it's shorter than the c example, but I don't know about speed
or readab
simendsjo:
> Suggestions for D-ifying the code is welcome.
Your unit tests are not good enough, they miss some important corner cases.
This my first version in D2:
import std.string: indexOf;
/// return True if s1 is a rotated version of s2
bool isRotated(T)(T[] s1, T[] s2) {
return (s1.leng
> bool isRotated(T)(T[] s1, T[] s2) {
A better signature for the same function, I need to train myself to use pure
and const more often :-)
pure bool isRotated(T)(const T[] s1, const T[] s2) {
Bye,
bearophile
On 02.09.2010 22:24, bearophile wrote:
simendsjo:
Suggestions for D-ifying the code is welcome.
Your unit tests are not good enough, they miss some important corner cases.
This my first version in D2:
import std.string: indexOf;
/// return True if s1 is a rotated version of s2
bool isRotated
On 09/02/2010 10:24 PM, bearophile wrote:
simendsjo:
Suggestions for D-ifying the code is welcome.
Your unit tests are not good enough, they miss some important corner cases.
This my first version in D2:
import std.string: indexOf;
/// return True if s1 is a rotated version of s2
bool isRota
13 matches
Mail list logo