Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like
On Monday, 20 August 2018 at 19:06:36 UTC, Seb wrote: [snip] That looks pretty cool! I added optional to run.dlang.io (e.g. https://run.dlang.io/is/912kVG) and the project tester (https://github.com/dlang/ci/pull/288). It's interesting that both sumtype and optional have match templates. Maybe scope to combine these projects?
Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like
On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote: Hi See: https://optional.dub.pm [...] That looks pretty cool! I added optional to run.dlang.io (e.g. https://run.dlang.io/is/912kVG) and the project tester (https://github.com/dlang/ci/pull/288).
Re: Beta 2.082.0
On Friday, 17 August 2018 at 20:01:32 UTC, Martin Nowak wrote: Glad to announce the first beta for the 2.082.0 release, ♥ to the 47 contributors for this release. [snip] On the "UDAs on function arguments are now supported" part of the change log, just to be clear, @(22) is added to "a" for the purposes of the test function. The variable need not have @22 outside of the function, correct?
DIP Draft Reviews
I'm getting ready to start prepping one of the DIPs in the PR queue for community review. It proposes adding an `in` operator for arrays. I haven't gone through it in detail yet, so I invite anyone with time on their hands to provide feedback on the Draft so we can more speedily get in shape to kick off the big-league reviews. https://github.com/dlang/DIPs/pull/101 While you're at it, feel free to poke around and leave some feedback on other drafts in the queue.
Re: D kernel for Jupyter notebook
On 08/20/2018 02:14 AM, Shigeki Karita wrote: > On Sunday, 19 August 2018 at 20:33:45 UTC, Laeeth Isharc wrote: >> Proof of concept works, but it requires some further development to be >> useful to do work in. >> >> [...] > > Great. I have tried DUB integration. It seems to work. > https://github.com/ShigekiKarita/grain/blob/master/example/repl.d Looks very interesting, though not quite ready for full drepl integration. https://github.com/dlang-community/drepl/issues/4#issuecomment-414331125
Mini numerical optimizer in D
Mini numerical optimizer in D: https://github.com/S6Regen/Dopt I also have this Walsh Hadamard code in D for Linux AMD 64: // Linux AMD64 extern(C) void hsixteen(float* x,ulong n,float scale){ asm{ naked; shufps XMM0,XMM0,0; align 16; h16: sub RSI,16; movups XMM1,[RDI]; movups XMM2,[RDI+16]; movups XMM3,[RDI+2*16]; movups XMM4,[RDI+3*16]; movups XMM5,XMM1; movups XMM6,XMM3; haddps XMM1,XMM2; haddps XMM3,XMM4; hsubps XMM5,XMM2; hsubps XMM6,XMM4; movups XMM2,XMM1; movups XMM4,XMM3; haddps XMM1,XMM5; haddps XMM3,XMM6; hsubps XMM2,XMM5; hsubps XMM4,XMM6; movups XMM5,XMM1; movups XMM6,XMM3; haddps XMM1,XMM2; haddps XMM3,XMM4; hsubps XMM5,XMM2; hsubps XMM6,XMM4; movups XMM2,XMM1; movups XMM4,XMM5; addps XMM1,XMM3; addps XMM5,XMM6; subps XMM2,XMM3; subps XMM4,XMM6; mulps XMM1,XMM0; mulps XMM5,XMM0; mulps XMM2,XMM0; mulps XMM4,XMM0; movups [RDI],XMM1; movups [RDI+16],XMM5; movups [RDI+2*16],XMM2; movups [RDI+3*16],XMM4; lea RDI,[RDI+64]; jnz h16; ret; } } extern(C) void hgap(float* x,ulong gap,ulong n){ asm{ naked; mov RCX,RSI; lea R8,[RDI+4*RSI]; shr RDX,1; align 16; hgaploop: sub RCX,16; movups XMM0,[RDI]; movups XMM1,[RDI+16]; movups XMM2,[RDI+2*16]; movups XMM3,[RDI+3*16]; movups XMM8,[R8]; movups XMM9,[R8+16]; movups XMM10,[R8+2*16]; movups XMM11,[R8+3*16]; movups XMM4,XMM0; movups XMM5,XMM1; movups XMM6,XMM2; movups XMM7,XMM3; addps XMM0,XMM8; addps XMM1,XMM9; addps XMM2,XMM10; addps XMM3,XMM11; subps XMM4,XMM8; subps XMM5,XMM9; subps XMM6,XMM10; subps XMM7,XMM11; movups [RDI],XMM0; movups [RDI+16],XMM1; movups [RDI+2*16],XMM2; movups [RDI+3*16],XMM3; movups [R8],XMM4; movups [R8+16],XMM5; movups [R8+2*16],XMM6; movups [R8+3*16],XMM7; lea RDI,[RDI+64]; lea R8,[R8+64]; jnz hgaploop; sub RDX,RSI; mov RCX,RSI; mov RDI,R8; lea R8,[R8+4*RSI]; jnz hgaploop; ret; } } void wht(float[] vec){ const ulong lim=8192; const ulong n=vec.length; ulong gap,k; float scale=1f/sqrt(to!float(n)); k=n; if( k>lim) k=lim; for(ulong i=0;iIt is the simplest algorithm in computer science least known, as I like to say. It actually has many uses. Eg. https://github.com/FALCONN-LIB/FFHT
Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like
On Monday, 20 August 2018 at 09:16:18 UTC, ikod wrote: On Thursday, 16 August 2018 at 16:20:09 UTC, aliak wrote: On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote: It's also @nogc and @safe No it's not. Not dispatching at least. Dunno why though. Seems safey is because taking an address. Nogc will have to look in to. Hello! please, help, how can I use match in @nogc code: import optional; void main() @nogc { Optional!int i = 1; bool b = true; i.match!( (v) => b, () => false ); } fails to compile: source/app.d(3,6): Error: function `D main` is @nogc yet allocates closures with the GC source/app.d(7,9):app.main.__lambda1 closes over variable b at source/app.d(5,10) Thanks! Hi, it's because the lambda "(v) => b" allocates. Same would happen with any other function that takes an alias to a lambda and that lambda causes a closure allocation. Changing this to "(int v) => b" seems to make the compiler infer @nogc though and it compiles. But it's still a delegate, so I'm not sure why that works and not sure in which situations D infers a nogc delegate. The same thing does not work for algorithm.map for e.g. Cheers - Ali
Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like
On Thursday, 16 August 2018 at 16:20:09 UTC, aliak wrote: On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote: It's also @nogc and @safe No it's not. Not dispatching at least. Dunno why though. Seems safey is because taking an address. Nogc will have to look in to. Hello! please, help, how can I use match in @nogc code: import optional; void main() @nogc { Optional!int i = 1; bool b = true; i.match!( (v) => b, () => false ); } fails to compile: source/app.d(3,6): Error: function `D main` is @nogc yet allocates closures with the GC source/app.d(7,9):app.main.__lambda1 closes over variable b at source/app.d(5,10) Thanks!