August 09, 2008 Re: DMD 1.034 and 2.018 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Probably I am missing something important, I have tried this code with the 1.034 (that compiles my large d libs fine), but I have found many problems: import std.stdio: putr = writefln; void main() { int[] a1 = [1, 2, 3]; int[] a2 = [2, 4, 6]; //putr(a1[] + a2[]); // test.d(6): Error: Array operations not implemented auto a3 = a1[] + 4; putr(a3); // [1,2,3,0,0,0,0] int[] a4 = a1[] + a2[]; // test.d(12): Error: Array operations not implemented int[] a5 = [3, 5, 7, 9]; int[] a6 = a1 + a5; // test.d(16): Error: Array operations not implemented int[] a7; a7[] = a1[] + a2[]; putr(a7); // prints: [] auto a8 = a1 + a2; // test.d(21): Error: Array operations not implemented putr(a8); } Few more questions/notes: - I like a syntax as a+b and a[]+4 instead of a[]+b[] and a[]+4, I am used to that from PyLab, etc. - How does it works (or not works) with jagged/square matrices? - When possible I'm do few benchmarks compared to normal D code, C code compiled normally with GCC and C code automatically vectorized by GCC. - Is it able to compute a+b+c with a single loop (as all Fortran compilers do)? I presume the answer is negative. - Hopefully in the future they may support the SSE3/SSSE3 too that my CPU supports. Bye, and good work, bearophile |
August 09, 2008 Re: DMD 1.034 and 2.018 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright Wrote:
> This one has (finally) got array operations implemented. For those who want to show off their leet assembler skills, the initial assembler implementation code is in phobos/internal/array*.d. Burton Radons wrote the assembler. Can you make it faster?
>
> http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.034.zip
>
> http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.018.zip
This will probably make me sound like an idiot, but what are these array operations everyone's so stoked about? I've only been learning D for a week and a half, fill me in!
BTW, nice update!
|
August 09, 2008 Re: DMD 1.034 and 2.018 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | bearophile:
> - I like a syntax as a+b and a[]+4 instead of a[]+b[] and a[]+4,
I meant:
a + b
a + 4
instead of:
a[] + b[]
a[] + 4
|
August 09, 2008 Re: DMD 1.034 and 2.018 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Michael P. | Michael P.: > This will probably make me sound like an idiot, but what are these array operations everyone's so stoked about? I've only been learning D for a week and a half, fill me in! If Walter gives you one link, you have to follow it before asking :-) http://www.digitalmars.com/d/1.0/arrays.html#array-operations Bye, bearophile |
August 09, 2008 Re: DMD 1.034 and 2.018 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | bearophile Wrote:
> Michael P.:
> > This will probably make me sound like an idiot, but what are these array operations everyone's so stoked about? I've only been learning D for a week and a half, fill me in!
>
> If Walter gives you one link, you have to follow it before asking :-) http://www.digitalmars.com/d/1.0/arrays.html#array-operations
>
> Bye,
> bearophile
Who knows where that could have led to... I was just playing it safe. :D
|
August 09, 2008 Re: DMD 1.034 and 2.018 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | "Lars Ivar Igesund" <larsivar@igesund.net> wrote in message news:g7ias2$2kbo$1@digitalmars.com... > Walter Bright wrote: > >> This one has (finally) got array operations implemented. For those who want to show off their leet assembler skills, the initial assembler implementation code is in phobos/internal/array*.d. Burton Radons wrote the assembler. Can you make it faster? >> >> http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.034.zip > > The array op docs aren't actually on the 1.0 array page. But great! I remember trying to use these 3 years ago :D Too bad Tango doesn't support them yet. :C |
August 09, 2008 Re: DMD 1.034 and 2.018 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Sat, Aug 9, 2008 at 7:30 AM, Walter Bright <newshound1@digitalmars.com> wrote: > Bill Baxter wrote: >> >> That is pretty neat. >> >> So does this mean you've reconsidered your position on adding new >> features to D1.x? >> Because q{} strings, 1..10 literals, and that enhancement to IFTI >> used by std.algorithm, all sure would be nice. I'd take those over >> fancy array ops any day. > > Array ops were always supposed to be there. Ok, I thought the charter for D1 was no new language features, period. FWIW, I always thought D1 IFTI was supposed to be smarter, so to me adding array ops seems to be similar to porting the fix for 493 to D1. (http://d.puremagic.com/issues/show_bug.cgi?id=493) --bb |
August 09, 2008 Re: DMD 1.034 and 2.018 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | bearophile wrote: > Probably I am missing something important, I have tried this code > with the 1.034 (that compiles my large d libs fine), but I have found > many problems: > > import std.stdio: putr = writefln; > > void main() { int[] a1 = [1, 2, 3]; int[] a2 = [2, 4, 6]; > > //putr(a1[] + a2[]); // test.d(6): Error: Array operations not > implemented It only works if the top level is an assignment operation. > > auto a3 = a1[] + 4; putr(a3); // [1,2,3,0,0,0,0] > > int[] a4 = a1[] + a2[]; // test.d(12): Error: Array operations not > implemented Doesn't work for initializers. > > int[] a5 = [3, 5, 7, 9]; int[] a6 = a1 + a5; // test.d(16): Error: > Array operations not implemented Doesn't work for initializers. > > int[] a7; a7[] = a1[] + a2[]; putr(a7); // prints: [] I don't know what putr is. > > auto a8 = a1 + a2; // test.d(21): Error: Array operations not > implemented Have to use slice [] operator. > putr(a8); } > > > Few more questions/notes: - I like a syntax as a+b and a[]+4 instead > of a[]+b[] and a[]+4, I am used to that from PyLab, etc. - How does > it works (or not works) with jagged/square matrices? It doesn't. - When possible > I'm do few benchmarks compared to normal D code, C code compiled > normally with GCC and C code automatically vectorized by GCC. - Is it > able to compute a+b+c with a single loop (as all Fortran compilers > do)? Yes. I presume the answer is negative. - Hopefully in the future they > may support the SSE3/SSSE3 too that my CPU supports. > > Bye, and good work, bearophile |
August 09, 2008 Re: DMD 1.034 and 2.018 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | bearophile wrote:
> bearophile:
>> - I like a syntax as a+b and a[]+4 instead of a[]+b[] and a[]+4,
>
> I meant:
> a + b
> a + 4
>
> instead of:
> a[] + b[]
> a[] + 4
D already distinguishes operations on the array handle, a, from operations on the contents of a, a[]. I think this is a good distinction.
|
August 09, 2008 Re: DMD 1.034 and 2.018 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote:
> This one has (finally) got array operations implemented. For those who want to show off their leet assembler skills, the initial assembler implementation code is in phobos/internal/array*.d. Burton Radons wrote the assembler. Can you make it faster?
>
> http://www.digitalmars.com/d/1.0/changelog.html
> http://ftp.digitalmars.com/dmd.1.034.zip
>
> http://www.digitalmars.com/d/2.0/changelog.html
> http://ftp.digitalmars.com/dmd.2.018.zip
Sweet! I love the way you put this forth as a challenge. Maybe D will have the worlds fastest array operations :)
-Joel
|
Copyright © 1999-2021 by the D Language Foundation