Re: why does this compile fine, but dies when you run it.

2018-03-22 Thread steven kladitis via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 18:55:34 UTC, Adam D. Ruppe wrote: On Wednesday, 21 March 2018 at 18:53:39 UTC, steven kladitis wrote: int[] array3; array3[0]=4; array3 is empty. You are trying to set a value that doesn't exist.. import std.stdio; void main(){ int[3] array1 = [ 10, 20, 30

why does this compile fine, but dies when you run it.

2018-03-21 Thread steven kladitis via Digitalmars-d-learn
import std.stdio; void main(){ int[3] array1 = [ 10, 20, 30 ]; auto array2 = array1; // array2's elements are different // from array1's array2[0] = 11; int[] array3; //array4[0]=3; array3[0]=4; auto array4 = array3; writeln(array1,'\n',array2,'\n',array3,'\n',array4); } -- windows 7 64 bit (

Re: trying to use nightly in windows 10 x64

2017-03-18 Thread steven kladitis via Digitalmars-d-learn
On Saturday, 18 March 2017 at 15:26:42 UTC, steven kladitis wrote: before trying nightly I run the c:\d\dmd2vars32.bat or c:\d\dmd2vars64.bat respectively. and I can compile an run either 32 or 64 bit executables. now I want to try nightly I renamed the current dmd directory in c:\d to

trying to use nightly in windows 10 x64

2017-03-18 Thread steven kladitis via Digitalmars-d-learn
before trying nightly I run the c:\d\dmd2vars32.bat or c:\d\dmd2vars64.bat respectively. and I can compile an run either 32 or 64 bit executables. now I want to try nightly I renamed the current dmd directory in c:\d to dmd_current I extracted the 7z file for nightly into c:\d the 32 bit

Re: I do not understand what the problem is in this code.

2017-03-03 Thread steven kladitis via Digitalmars-d-learn
On Friday, 3 March 2017 at 04:14:02 UTC, Jordan Wilson wrote: On Friday, 3 March 2017 at 03:11:24 UTC, steven kladitis wrote: [...] I saw this answer for a similar question from Adam D. Ruppe: Quote: "...it is anything that Phobos considers "bidirectional" and "swappable" - an array it can

I do not understand what the problem is in this code.

2017-03-02 Thread steven kladitis via Digitalmars-d-learn
void main() { import std.stdio, std.range, std.algorithm, std.string; const pieces = "KQRrBbNN"; alias I = indexOf; auto starts = permutations(pieces.dup).filter!(p => I(p, 'B') % 2 != I(p, 'b') % 2 && // Bishop constraint. // King constraint.

Merry Christmas

2015-12-23 Thread steven kladitis via Digitalmars-d-learn
Twas the Night before Christmas and all through my D code. The compiler was compiling the new and the olde. Thanks to Walter, Alexander and Ali. I try to write more D code with happiness and Glee. In the forums with help from folks like me galore. I find I am not crazy, just need to learn more.

Lots of D code

2015-12-22 Thread steven kladitis via Digitalmars-d-learn
I have 843 programs written in D. 805 actually create an 32 bit exe in windows 10. I am running the latest D. Some just start to link and the linker disappears. Some just have issues I am not able figure out. I can attach the code and scripts I use to compile and run these. If anyone is

Re: why does this error out?

2015-11-10 Thread steven kladitis via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 05:14:29 UTC, lobo wrote: On Tuesday, 10 November 2015 at 04:34:22 UTC, Cauterite wrote: Here's the output I get (DMD v2.068.2): [1, 3, 10, 12, 21, 30, 100, 102, 111, 120, 201, 210] core.exception.AssertError@std\range\package.d(4603): Assertion failure

why does this error out?

2015-11-09 Thread steven kladitis via Digitalmars-d-learn
void main() { import std.stdio, std.algorithm, std.range, std.conv; enum digSum = (int n) => n.text.map!(d => d - '0').sum; //enum harshads = iota(1, int.max).filter!(n => n % digSum(n) == 0); enum harshads = iota(1, 256).filter!(n => n % digSum(n) == 0);

Re: Align a variable on the stack.

2015-11-06 Thread steven kladitis via Digitalmars-d-learn
On Friday, 6 November 2015 at 01:17:20 UTC, TheFlyingFiddle wrote: On Friday, 6 November 2015 at 00:43:49 UTC, rsw0x wrote: On Thursday, 5 November 2015 at 23:37:45 UTC, TheFlyingFiddle wrote: On Thursday, 5 November 2015 at 21:24:03 UTC, TheFlyingFiddle wrote: [...] I reduced it further:

Re: good reasons not to use D?

2015-11-03 Thread steven kladitis via Digitalmars-d-learn
On Monday, 2 November 2015 at 17:09:41 UTC, Laeeth Isharc wrote: On Saturday, 31 October 2015 at 16:06:47 UTC, Russel Winder wrote: On Sat, 2015-10-31 at 15:41 +, tcak via Digitalmars-d-learn wrote: [...] In that std.bigint.BigInt provides the accuracy, yes it does suffice. But it is

how to make the commented out lines work when they are uncommented

2015-11-02 Thread steven kladitis via Digitalmars-d-learn
import std.stdio, std.algorithm, std.array, std.traits,std.range, std.typecons,std.complex; enum AreSortableArrayItems(T) = isMutable!T && __traits(compiles, T.init < T.init) && !isNarrowString!(T[]); void selectionSort(T)(T[]

what is wrong with this code??

2015-10-17 Thread steven kladitis via Digitalmars-d-learn
import std.string, std.typecons, std.exception, std.algorithm,std.stdio; import std.traits: hasIndirections; struct GrowableCircularQueue(T) { public size_t length; private size_t first, last; private T[] A = [T.init]; this(T[] items...) pure nothrow @safe { foreach (x;

Re: what is wrong with this code??

2015-10-17 Thread steven kladitis via Digitalmars-d-learn
On Saturday, 17 October 2015 at 14:47:11 UTC, anonymous wrote: On Saturday, October 17, 2015 04:17 PM, steven kladitis wrote: // it thows a range exception On which line? core.exception.RangeError@sokuban.d(84): Range violation

Re: what is wrong with this code??

2015-10-17 Thread steven kladitis via Digitalmars-d-learn
On Saturday, 17 October 2015 at 14:59:41 UTC, anonymous wrote: On Saturday, October 17, 2015 04:50 PM, steven kladitis wrote: core.exception.RangeError@sokuban.d(84): Range violation Line 84 being this: sDataBuild ~= sMap[ch]; Where sMap is: /*static*/ immutable sMap

Re: problem with exceptions

2015-10-02 Thread steven kladitis via Digitalmars-d-learn
On Friday, 2 October 2015 at 12:18:36 UTC, Dmitri wrote: On Friday, 2 October 2015 at 11:44:21 UTC, steven kladitis wrote: C:\d\examples>pb2 =>main's first line =>makeOmelet's first line =>prepareAll's first line =>prepareEggs's first line object.Exception@pb2.d(64): Cannot take -8

problem with exceptions

2015-10-02 Thread steven kladitis via Digitalmars-d-learn
C:\d\examples>pb2 =>main's first line =>makeOmelet's first line =>prepareAll's first line =>prepareEggs's first line object.Exception@pb2.d(64): Cannot take -8 eggs from the fridge 0x00402252 0x0040512F 0x00405043 0x00403E48 0x7600338A in BaseThreadInitThunk

question about multiple alias this

2015-09-24 Thread steven kladitis via Digitalmars-d-learn
class A{ int i; bool b; alias i this; alias b this; } void main() { auto a = new A; int i = a; bool b = a; } --- this will not compile in dmd 2068.1. --- ok, but what technique do you use to emulate this type of behavior?? --- would interfaces be the answer, if so could I see an

Re: number formatting

2014-04-20 Thread steven kladitis via Digitalmars-d-learn
Note sure if you can edit messages once sent. $13,456.67 245,678,541 On Sunday, 20 April 2014 at 12:50:52 UTC, steven kladitis wrote: How do you format numbers to have things like. Leading $ or , or CR with or without leading zeros. for example $56.00 $056.00

number formatting

2014-04-20 Thread steven kladitis via Digitalmars-d-learn
How do you format numbers to have things like. Leading $ or , or CR with or without leading zeros. for example $56.00 $056.00 $1,3456.67 345.89CR

Re: arrays in DMD V2

2014-04-19 Thread steven kladitis via Digitalmars-d-learn
void main() { //inta0[]; int[] a0; //inta1[][]; int[][] a1; //string a2[][]; string[][] a2; //string a3[][string]; string[string] a3; // string[][string] a3; // possibly should be above for a3 //string a4[][string][string]; string[][string][string] a4; //string

Re: arrays in DMD V2

2014-04-19 Thread steven kladitis via Digitalmars-d-learn
Fantastic I am getting a much clearer picture of arrays I appreciate all of the help I see many examples of D online, but most do not compile under 2.065. I am wondering if there is a D manual or book just for D V2.0.

arrays in DMD V2

2014-04-18 Thread steven kladitis via Digitalmars-d-learn
import std.stdio; void main() { inta0[]; inta1[][]; string a2[][]; string a3[][string]; string a4[][string][string]; //string a4[string][string][string]; is this the same as above inta5[][string][string][string]; inta6[string][int][string][float]; int

Re: arrays in DMD V2

2014-04-18 Thread steven kladitis via Digitalmars-d-learn
Thanks, I am trying to understand what I am doing. The docs seem unclear to me on how to initialize these. I think there are three ways. with brackets , the other with foreach or direct assignments. -- here is a longer version -- uncomment out the assignments to see the errors I get. -- I am

Re: arrays in DMD V2

2014-04-18 Thread steven kladitis via Digitalmars-d-learn
import std.stdio; void main() { inta0[]; inta1[][]; string a2[][]; string a3[][string]; string a4[][string][string]; //string a4[string][string][string]; is this the same as above inta5[][string][string][string]; inta6[string][int][string][float]; int