Re: D on ARM laptops?

2019-07-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 4, 2019 2:49:18 AM MDT zoujiaqing via Digitalmars-d-learn wrote: > On Thursday, 4 July 2019 at 07:46:53 UTC, Paolo Invernizzi wrote: > > On Thursday, 4 July 2019 at 01:01:03 UTC, Nicholas Wilson wrote: > >> On Wednesday, 3 July 2019 at 20:49:20 UTC, JN wrote: > >>> Does anyone kn

Re: Finding Max Value of Column in Multi-Dimesional Array

2019-07-04 Thread Jordan Wilson via Digitalmars-d-learn
On Friday, 5 July 2019 at 00:54:15 UTC, Samir wrote: Is there a cleaner way of finding the maximum value of say the third column in a multi-dimensional array than this? int[][] p = [[1,2,3,4], [9,0,5,4], [0,6,2,1]]; writeln([p[0][2], p[1][2], p[2][2]].max); I've tried the following writeln([0,

Re: Finding Max Value of Column in Multi-Dimesional Array

2019-07-04 Thread 9il via Digitalmars-d-learn
On Friday, 5 July 2019 at 00:54:15 UTC, Samir wrote: Is there a cleaner way of finding the maximum value of say the third column in a multi-dimensional array than this? int[][] p = [[1,2,3,4], [9,0,5,4], [0,6,2,1]]; writeln([p[0][2], p[1][2], p[2][2]].max); I've tried the following writeln([0,

Finding Max Value of Column in Multi-Dimesional Array

2019-07-04 Thread Samir via Digitalmars-d-learn
Is there a cleaner way of finding the maximum value of say the third column in a multi-dimensional array than this? int[][] p = [[1,2,3,4], [9,0,5,4], [0,6,2,1]]; writeln([p[0][2], p[1][2], p[2][2]].max); I've tried the following writeln([0, 1, 2].map!(p[a][2]).max); but get an "Error: undefine

Re: Anyway to compare function aliases? Or any ideas?

2019-07-04 Thread aliak via Digitalmars-d-learn
On Thursday, 4 July 2019 at 15:22:08 UTC, Marco de Wild wrote: On Thursday, 4 July 2019 at 15:10:05 UTC, aliak wrote: [...] I don't know if it will solve your whole problem, but have you tried __traits(isSame, W0.fun, fun)? Reduced example: struct Foo(alias fun){ alias bar = fun; } vo

Re: For loop with separator

2019-07-04 Thread Alex via Digitalmars-d-learn
On Thursday, 4 July 2019 at 17:00:33 UTC, Q. Schroll wrote: Probably you've come over this problem once in a while, too. You have a repeating solution, so you use a for(each) loop. Sometimes, there is an action to be performed between the end of one iteration and the beginning of the next, if th

For loop with separator

2019-07-04 Thread Q. Schroll via Digitalmars-d-learn
Probably you've come over this problem once in a while, too. You have a repeating solution, so you use a for(each) loop. Sometimes, there is an action to be performed between the end of one iteration and the beginning of the next, if there is one. The prime example is printing the comma when pri

Re: Anyway to compare function aliases? Or any ideas?

2019-07-04 Thread Marco de Wild via Digitalmars-d-learn
On Thursday, 4 July 2019 at 15:10:05 UTC, aliak wrote: Any ideas on how to be able to do something like this? struct S(alias _fun) { alias Fun = _fun; } void algorithm(alias f, T)(T s) { static if (&f == &T.Fun) { // trivial return } else { // must perform work, then return } }

Anyway to compare function aliases? Or any ideas?

2019-07-04 Thread aliak via Digitalmars-d-learn
Any ideas on how to be able to do something like this? struct S(alias _fun) { alias Fun = _fun; } void algorithm(alias f, T)(T s) { static if (&f == &T.Fun) { // trivial return } else { // must perform work, then return } } Can you use function addresses in some way? I've seen t

Re: Why are immutable array literals heap allocated?

2019-07-04 Thread a11e99z via Digitalmars-d-learn
On Thursday, 4 July 2019 at 10:56:50 UTC, Nick Treleaven wrote: immutable(int[]) f() @nogc { return [1,2]; } onlineapp.d(2): Error: array literal in `@nogc` function `onlineapp.f` may cause a GC allocation specify the size of the static array: immutable(int[ 2 /*HERE*/ ]) f() @nogc { re

Re: Why are immutable array literals heap allocated?

2019-07-04 Thread Eugene Wissner via Digitalmars-d-learn
On Thursday, 4 July 2019 at 10:56:50 UTC, Nick Treleaven wrote: immutable(int[]) f() @nogc { return [1,2]; } onlineapp.d(2): Error: array literal in `@nogc` function `onlineapp.f` may cause a GC allocation This makes dynamic array literals unusable with @nogc, and adds to GC pressure for

Why are immutable array literals heap allocated?

2019-07-04 Thread Nick Treleaven via Digitalmars-d-learn
immutable(int[]) f() @nogc { return [1,2]; } onlineapp.d(2): Error: array literal in `@nogc` function `onlineapp.f` may cause a GC allocation This makes dynamic array literals unusable with @nogc, and adds to GC pressure for no reason. What code would break if dmd used only static data f

Re: Associative Array & different template types

2019-07-04 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-07-03 19:07:10 +, ag0aep6g said: On 03.07.19 20:20, Robert M. Münch wrote: So, I need to carry around the object from which a delegate was created from because it's not possible to query the delegate for the object later somewhere else in the code. It is possible to get the conte

Re: Blog Post #0048: Model, View, Controller

2019-07-04 Thread Ron Tarrant via Digitalmars-d-learn
On Wednesday, 3 July 2019 at 17:12:04 UTC, lpcvoid wrote: Thanks for the time you invest in this. You're welcome. Tell your friends. :)

Re: D on ARM laptops?

2019-07-04 Thread zoujiaqing via Digitalmars-d-learn
On Thursday, 4 July 2019 at 07:46:53 UTC, Paolo Invernizzi wrote: On Thursday, 4 July 2019 at 01:01:03 UTC, Nicholas Wilson wrote: On Wednesday, 3 July 2019 at 20:49:20 UTC, JN wrote: Does anyone know if and how well D works on ARM laptops (such as Chromebooks and similar)? For example this o

Re: D on ARM laptops?

2019-07-04 Thread Paolo Invernizzi via Digitalmars-d-learn
On Thursday, 4 July 2019 at 01:01:03 UTC, Nicholas Wilson wrote: On Wednesday, 3 July 2019 at 20:49:20 UTC, JN wrote: Does anyone know if and how well D works on ARM laptops (such as Chromebooks and similar)? For example this one https://www.pine64.org/pinebook/ . Can it compile D? Obviously