Re: Real simple question... for good programmers

2022-10-22 Thread Enjoys Math via Digitalmars-d-learn
__MWE Code:__ ``` module DlangForumsMWE; import std.stdio; import std.algorithm.mutation; int main() { //string[] tokens = userSID.output.split!isWhite; //writeln("tokens = ", tokens); auto tokens = ["SID", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",

Re: Real simple question... for good programmers

2022-10-22 Thread Enjoys Math via Digitalmars-d-learn
On Saturday, 22 October 2022 at 21:53:05 UTC, WhatMeWorry wrote: string[] tokens = userSID.output.split!isWhite; writeln("tokens = ", tokens); tokens = ["SID", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",

Removing elements from dynamic arrays?

2022-04-04 Thread Enjoys Math via Digitalmars-d-learn
https://forum.dlang.org/post/eih04u$1463$1...@digitaldaemon.com A version of the code that takes `T which` as a parameter instead of `int index`. ``` // remove an item from an array template drop(T) { T drop( inout T[] arr, T which ) { int i; T

How do you get passed `LNK: cannot find python39.lib` errors when using PyD for Python to D calling?

2022-04-04 Thread Enjoys Math via Digitalmars-d-learn
``` C:\Users\FruitfulApproach\Desktop\BananaCats\BananaCatsInD\pyd\infrastructure\pyd\make_object.d(1190): Deprecation: returning `` escapes a reference to parameter `this` C:\Users\FruitfulApproach\Desktop\BananaCats\BananaCatsInD\pyd\infrastructure\pyd\make_object.d(1190): perhaps

Function prototype overloading does not work ?

2022-01-19 Thread Enjoys Math via Digitalmars-d-learn
``` module expr; import dots; import operator; import equation; import var; import var_expr; import zz_const; class Expr { public: void opBinary(string op)(string s) const { static if (op == "+") { Expr right = null; if (s == ".." || s == "..." || s ==

Does D have any number theory libraries?

2021-11-08 Thread Enjoys Math via Digitalmars-d-learn
In particular what I need are the fast implementations of: 1. The Nth prime number. 2. Prime Omega and/or Mobius function. 3. Works with some type of BigInt. 4. Primorial. 5. Divisors of N. 6. Extended GCD algorithm. They don't have to be the state-of-the art, but it would be nice if they

`This` reference not accessible when overloading an operator?

2020-01-21 Thread Enjoys Math via Digitalmars-d-learn
I have an Integer class in integer.d. A RationalNumber class in rational_number.d, and they each import each other (so that could be the issue). However, this is not working: Symbol opBinary(string op : "/")(const Integer z) const { return new RationalNumber(this, z); }

I'm fucking tired of this shit... Why doesn't Visual D install ?

2019-09-03 Thread Enjoys Math via Digitalmars-d-learn
It says right on the front page of it, that it installs in 2019. I of course have the C++ tools installed already because I was doing C++ dev in Qt and needed to. Where's the Visual D menu? Where are the project types? This fucking sucks. Every time I think oh, I could use D on that, it

Re: Is it possible to target all platforms that Qt Quick can target?

2019-08-14 Thread Enjoys Math via Digitalmars-d-learn
I cannot use QML for D or other D Qt libraries. I'm writing something important and need all of Qt Creator and its C++ editing environment. I don't wish to go through the bad experience of using those libraries. I've tried it before. I do D in Visual D, and that would be for the backend

Re: Is it possible to target all platforms that Qt Quick can target?

2019-08-12 Thread Enjoys Math via Digitalmars-d-learn
Any ideas on this?

Re: Is it possible to target all platforms that Qt Quick can target?

2019-08-12 Thread Enjoys Math via Digitalmars-d-learn
On Monday, 12 August 2019 at 18:30:24 UTC, Kagamin wrote: You're probably interested in readiness, not possibility? I am interested in both. If I begin coding in D today, it will likely be 8 months until the backend is completed.

Is it possible to target all platforms that Qt Quick can target?

2019-08-12 Thread Enjoys Math via Digitalmars-d-learn
Hi, I'm writing my GUI in C++ & Qt Quick. I know that I could connect to D from the GUI code using a DLL, but can something similar be done on the other PC OS's and the mobile OS's? Thanks.

Re: VisualD phobos link error, only when I implement a few simple classes on top of a hello world program.

2019-02-06 Thread Enjoys Math via Digitalmars-d-learn
I tried re-installing DMD, and now for either 64-bit or x86 build mode, I'm getting the Phobos linker error: -- Build started: Project: BasicSimpleTypeTheoryApp, Configuration: Debug x64 -- Building x64\Debug\BasicSimpleTypeTheoryApp.exe... LINK : fatal error LNK1104: cannot open file

VisualD phobos link error, only when I implement a few simple classes on top of a hello world program.

2019-02-06 Thread Enjoys Math via Digitalmars-d-learn
What is this phobos crap? I've tried renaming all my modules with an _ (underscore) in case they were colliding with phobos. -- Build started: Project: BasicSimpleTypeTheoryApp, Configuration: Debug Win32 -- Building Win32\Debug\BasicSimpleTypeTheoryApp.exe... LINK : fatal error

Re: VisualD phobos link error, only when I implement a few simple classes on top of a hello world program.

2019-02-06 Thread Enjoys Math via Digitalmars-d-learn
On Wednesday, 6 February 2019 at 17:53:05 UTC, Enjoys Math wrote: What is this phobos crap? I've tried renaming all my modules with an _ (underscore) in case they were colliding with phobos. -- Build started: Project: BasicSimpleTypeTheoryApp, Configuration: Debug Win32 -- Building

Re: Has anyone tried making a QtCreator plugin for D and what is your experience?

2019-01-12 Thread Enjoys Math via Digitalmars-d-learn
On Saturday, 12 January 2019 at 16:09:22 UTC, Laurent Tréguier wrote: On Saturday, 12 January 2019 at 15:16:25 UTC, Laurent Tréguier wrote: QtCreator 4.8.0 introduced support for the LSP last month : https://blog.qt.io/blog/2018/12/06/qt-creator-4-8-0-released I think I'm going to add it to

Has anyone tried making a QtCreator plugin for D and what is your experience?

2019-01-11 Thread Enjoys Math via Digitalmars-d-learn
I'm 5 years an expert at PyQt5 in conjunction with QtCreator-designed widgets. Where D is lacking is a good GUI editor and GUI library support. I am starting by building a python-based project called QDmt = Qt/D manager It will do for you, in a cross-platform way, the laborious task of

Re: Coedit almost works for me, except when I go to add peggged

2019-01-11 Thread Enjoys Math via Digitalmars-d-learn
On Friday, 11 January 2019 at 18:36:18 UTC, 0xEAB wrote: On Friday, 11 January 2019 at 18:27:37 UTC, Enjoys Math wrote: Dude, that doesn't work either. lol If you're using DUB, add the dependency manually to your project: "dependencies": {"pegged": "~>0.4.4"} You will have to be more

Re: Coedit almost works for me, except when I go to add peggged

2019-01-11 Thread Enjoys Math via Digitalmars-d-learn
On Friday, 11 January 2019 at 17:38:31 UTC, Neia Neutuladh wrote: On Fri, 11 Jan 2019 17:25:29 +, Enjoys Math wrote: Package peggged not found for registry at https://code.dlang.org/ The package name is pegged, not peggged. Two g's, not three. Dude, that doesn't work either. lol

Re: All these errors running basic Pegged helloworld example.

2019-01-11 Thread Enjoys Math via Digitalmars-d-learn
On Friday, 11 January 2019 at 17:44:33 UTC, Michelle Long wrote: On Sunday, 27 September 2015 at 06:30:37 UTC, Enjoys Math wrote: [...] You need to add most of the pegged files... there are more than 3. Try adding them all first then remove the junk like the examples, docs, etc until it

Re: All these errors running basic Pegged helloworld example.

2019-01-11 Thread Enjoys Math via Digitalmars-d-learn
On Sunday, 27 September 2015 at 07:16:51 UTC, BBasile wrote: On Sunday, 27 September 2015 at 06:30:37 UTC, Enjoys Math wrote: The example is: import pegged.grammar; mixin(grammar(` Arithmetic: Term < Factor (Add / Sub)* Add < "+" Factor Sub < "-" Factor Factor

Coedit almost works for me, except when I go to add peggged

2019-01-11 Thread Enjoys Math via Digitalmars-d-learn
I open up the Library Manager in Coedit. I click on the DUB icon. I enter in 'pegged' then click the green check. Errors: Package peggged not found for registry at https://code.dlang.org/ (fallback ["registry at http://code.dlang.org/;, "registry at https://code-mirror.dlang.io/;, "registry

dub generate visuald shits on me

2019-01-11 Thread Enjoys Math via Digitalmars-d-learn
I do: dub init simple_type_theory cd simple_type_theory dub generate visuald Errors: C:\Users\FruitfulApproach\Desktop\_SIMPLE_TYPE_THEORY\simple_type_theory>dub generate visuald simple_type_theory Building package simple_type_theory in

Re: Why can't or shouldn't I just hash the address of an object? And how.

2018-12-30 Thread Enjoys Math via Digitalmars-d-learn
On Sunday, 30 December 2018 at 05:54:05 UTC, Neia Neutuladh wrote: On Sun, 30 Dec 2018 05:36:41 +, Enjoys Math wrote: Is it: typeof(T).getHash()? This gets the hashcode for the object by calling toHash() on it. Or does that do something other than just get the address? It XORs the

Why can't or shouldn't I just hash the address of an object? And how.

2018-12-29 Thread Enjoys Math via Digitalmars-d-learn
I am creating a custom graph database for our app. It holds not one huge graph but a collection of independent graphs. I would like to be able to delete them without looping through a range of billions of Graph class references. How can I accomplish this with an AA and hasing? Is it:

How do you get a .dub project to build / run / debug in Visual D?

2018-10-17 Thread Enjoys Math via Digitalmars-d-learn
I'm referring mainly to the `dagon` game engine. Doing: dub build :tutorial1 dub run :tutorial1 works on windows 10. I'm not sure how to replicate this build process with Visual Studio 2017 project settings. Dagon is building, but I'm getting errors with a basic Hellow World app in Dagon.

Re: Do D's std.signals check for already-connected slot and simply ignore the call?

2018-10-17 Thread Enjoys Math via Digitalmars-d-learn
Answer: they don't connect uniquely, you have to manage that yourself.

Do D's std.signals check for already-connected slot and simply ignore the call?

2018-10-16 Thread Enjoys Math via Digitalmars-d-learn
If they don't, I have to wrap it like so: import std.signals; class Signal(T) { protected: mixin Signal!(T); }; class Changed(T) : Signal!T { protected: void delegate(T)[] slots; public: override void connect(void delegate(T) slot) { foreach (s; slots) { if (s == slot)

Re: Access violation connecting a signal / slot

2018-10-16 Thread Enjoys Math via Digitalmars-d-learn
Solved: I forgot to initialize some member variable along the way, which is a class so needed to be new'd. Thanks.

Access violation connecting a signal / slot

2018-10-16 Thread Enjoys Math via Digitalmars-d-learn
I have a class or struct (have tried both; same error): module track_changes; import std.array; import std.signals; class TrackChanges(T) { private: T[] _stack; int _current = 0; public: mixin Signal!(T); TrackChanges opAssign(TrackChanges x) { this = x(); return

Re: How do you connect Python with D via socket, I'm still getting connection refused error

2018-05-10 Thread Enjoys Math via Digitalmars-d-learn
On Friday, 4 May 2018 at 13:52:29 UTC, Andy Smith wrote: On Thursday, 3 May 2018 at 23:58:24 UTC, Enjoys Math wrote: Error - [...] Haven't run it, but two things to try... On D side try adding listen after bind. On python side. Don't think you need to call bind the client socket

How do you connect Python with D via socket, I'm still getting connection refused error

2018-05-03 Thread Enjoys Math via Digitalmars-d-learn
Error - builtins.ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it Python Side --- from PyQt5.QtWidgets import QApplication, QMainWindow import sys import socket import settings if __name__ == "__main__": app

Re: What's the latest news for calling D from python 3 using ctypes?

2018-02-28 Thread Enjoys Math via Digitalmars-d-learn
On Wednesday, 28 February 2018 at 17:34:49 UTC, Enjoys Math wrote: == Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped == For some reason, idk why, PyD is a dub source dependency (as opposed to a library). If you add \path\to\pyd to the include directory(?) dub variable

Re: What's the latest news for calling D from python 3 using ctypes?

2018-02-28 Thread Enjoys Math via Digitalmars-d-learn
== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped == For some reason, idk why, PyD is a dub source dependency (as opposed to a library). If you add \path\to\pyd to the include directory(?) dub variable (or -I\path\to\pyd to dmd/ldc/gdc) it should hopefully work.

Re: What's the latest news for calling D from python 3 using ctypes?

2018-02-27 Thread Enjoys Math via Digitalmars-d-learn
On Wednesday, 28 February 2018 at 00:18:17 UTC, Nicholas Wilson wrote: On Tuesday, 27 February 2018 at 23:59:10 UTC, Enjoys Math wrote: I am making a library that will run very speedily in D (or, failing that, C++) and do the backend work of a PyQt5 gui. Was wondering the simplest route to

Re: What's the latest news for calling D from python 3 using ctypes?

2018-02-27 Thread Enjoys Math via Digitalmars-d-learn
Can't build now: -- Build started: Project: categorytheorybackend, Configuration: debug Win32 -- Building C:\MyProjects\___ENJOYS_MATH\CategoryTheoryFrontend\CategoryTheoryBackend\categorytheorybackend.exe... Error: Error writing file

Re: What's the latest news for calling D from python 3 using ctypes?

2018-02-27 Thread Enjoys Math via Digitalmars-d-learn
On Wednesday, 28 February 2018 at 01:10:36 UTC, Enjoys Math wrote: Got it. dub init myproject from within my python frontend source dir will create a subdirectory. Then you do dub generate visuald from within the subdir myproject.

Re: What's the latest news for calling D from python 3 using ctypes?

2018-02-27 Thread Enjoys Math via Digitalmars-d-learn
Got it. dub init myproject from within my python frontend source dir will create a subdirectory.

Re: What's the latest news for calling D from python 3 using ctypes?

2018-02-27 Thread Enjoys Math via Digitalmars-d-learn
On Wednesday, 28 February 2018 at 00:18:17 UTC, Nicholas Wilson wrote: On Tuesday, 27 February 2018 at 23:59:10 UTC, Enjoys Math wrote: I am making a library that will run very speedily in D (or, failing that, C++) and do the backend work of a PyQt5 gui. Was wondering the simplest route to

What's the latest news for calling D from python 3 using ctypes?

2018-02-27 Thread Enjoys Math via Digitalmars-d-learn
I am making a library that will run very speedily in D (or, failing that, C++) and do the backend work of a PyQt5 gui. Was wondering the simplest route to accomplish this, preferably in ctypes calls. Thanks.

Is this an okay representation of a dynamically sized Matrix, to be used for HMM matrices m = (A,B)

2017-12-27 Thread Enjoys Math via Digitalmars-d-learn
Code: module matrix; import std.array; struct Matrix(E) { private: E[][]; this() { } void deleteRow(int i) { E = E[0..i] ~ E[i..$]; } void deleteColumn(int j) { for (int i=0; i < E.length; i++) { E[i] = E[i][0..j] ~ E[i][j..$];

What is a robust implementation of a file mutex? Mine is sucking...

2017-12-14 Thread Enjoys Math via Digitalmars-d-learn
I share data between two programs. Programs on side A output .bin files full of doubles like around 19KB each. And there can be between 30 - 100 of these bin files. I have a thread for each file on the B side, which first checks the existence of filename__MUTEX.txt. If it exist, then a

Strange behavior of cast(int[]) json["my int list"].array

2017-11-15 Thread Enjoys Math via Digitalmars-d-learn
I had it working in an earlier program. Now I have: main.d -- import std.json; import std.file; int main() { JSONValue settings; settings = parseJSON("settings.txt"); auto intList = cast(int[]) settings["int list"].array; writeln(intList); readln(); } for input:

Re: How do you open a second console? I have multiple streams of info I want printed.

2017-11-13 Thread Enjoys Math via Digitalmars-d-learn
On Monday, 13 November 2017 at 20:24:38 UTC, Jonathan M Davis wrote: On Monday, November 13, 2017 19:58:51 Enjoys Math via Digitalmars-d-learn wrote: Hi, I tried googling and didn't find anything. I have thread doing a time-intensive search and I want its results printed to a second console

How do you open a second console? I have multiple streams of info I want printed.

2017-11-13 Thread Enjoys Math via Digitalmars-d-learn
Hi, I tried googling and didn't find anything. I have thread doing a time-intensive search and I want its results printed to a second console while the main console displays what I already have writing. Thanks.

Re: Connecting python to D on socket of localhost : target machine actively refuses connection

2017-09-21 Thread Enjoys Math via Digitalmars-d-learn
On Friday, 22 September 2017 at 05:43:24 UTC, Nicholas Wilson wrote: On Friday, 22 September 2017 at 04:37:44 UTC, Enjoys Math wrote: On Friday, 22 September 2017 at 04:25:00 UTC, Enjoys Math wrote: I've tried opening the port for TCP with windows 10 firewall settings. Same result. What

Re: Connecting python to D on socket of localhost : target machine actively refuses connection

2017-09-21 Thread Enjoys Math via Digitalmars-d-learn
On Friday, 22 September 2017 at 04:25:00 UTC, Enjoys Math wrote: I've tried opening the port for TCP with windows 10 firewall settings. Same result. What tool would best help me debug this? Wireshark or is that too low level? I've used Hercules:

Re: Connecting python to D on socket of localhost : target machine actively refuses connection

2017-09-21 Thread Enjoys Math via Digitalmars-d-learn
I've tried opening the port for TCP with windows 10 firewall settings. Same result. What tool would best help me debug this? Wireshark or is that too low level?

Connecting python to D on socket of localhost : target machine actively refuses connection

2017-09-21 Thread Enjoys Math via Digitalmars-d-learn
Here's my minimal D code (server.d): module server; import core.thread; import std.socket; import std.experimental.logger; class Server : Thread { private: Socket listener; int backlog; string address; ushort port; SocketSet sockSet; Socket[]

Re: What is the canonical way to subclass Thread and make it pauseable?

2017-09-17 Thread Enjoys Math via Digitalmars-d-learn
On Sunday, 17 September 2017 at 19:57:05 UTC, Enjoys Math wrote: How do you write a pauseable Thread? Thanks. This seems to work: module data_rates_thread; import core.thread; import std.datetime; class DataRatesThread : Thread { private: uint loopSleep; bool paused;

What is the canonical way to subclass Thread and make it pauseable?

2017-09-17 Thread Enjoys Math via Digitalmars-d-learn
How do you write a pauseable Thread? Thanks.

Re: My friend can't install DMD 2.076.0 after he deleted contents of C:\D

2017-09-16 Thread Enjoys Math via Digitalmars-d-learn
On Sunday, 17 September 2017 at 05:30:51 UTC, Enjoys Math wrote: Series of messages from installer: DMD v2.076.0 is installed on your system Press 'OK' to replace by DMD 2.076.0 An error occurred when removing DMD v2.076.0 Run 'dmd-2.076.0.exe /f to force install And using the command line

My friend can't install DMD 2.076.0 after he deleted contents of C:\D

2017-09-16 Thread Enjoys Math via Digitalmars-d-learn
Series of messages from installer: DMD v2.076.0 is installed on your system Press 'OK' to replace by DMD 2.076.0 An error occurred when removing DMD v2.076.0 Run 'dmd-2.076.0.exe /f to force install And using the command line has no effect - it repeats the above. He got into this situation by

Re: How do I create a fileWatcher with an onFileChange event using spawn?

2017-08-28 Thread Enjoys Math via Digitalmars-d-learn
On Monday, 28 August 2017 at 06:27:20 UTC, Jacob Carlborg wrote: On 2017-08-25 23:25, Enjoys Math wrote: Something like this: module file_watcher; import std.concurrency; import std.file; import std.signals; import std.datetime; void fileWatcher(Tid tid, string filename, int loopSleep) {

Unable to set static data member of a class (results in default value 0)

2017-08-27 Thread Enjoys Math via Digitalmars-d-learn
I have: class DataSignal : Thread { public: static int dataReadDelay; void run() { while (true) { Thread.sleep(dur!"msecs"(dataReadDelay)); // Read in the new file data } } } in main I have: DataSignal.dataReadDelay = 8000; // initialize a

Re: How do I send a message to a struct member function?

2017-08-26 Thread Enjoys Math via Digitalmars-d-learn
On Saturday, 26 August 2017 at 10:05:31 UTC, drug wrote: 26.08.2017 09:49, Enjoys Math пишет: I have a series of structs each of which needs to spawn a worker thread on initialization. There seems to be no way to send a message back to the struct for instance to cause a member function

How do I send a message to a struct member function?

2017-08-26 Thread Enjoys Math via Digitalmars-d-learn
I have a series of structs each of which needs to spawn a worker thread on initialization. There seems to be no way to send a message back to the struct for instance to cause a member function call on /that/ structs data. Please advise me.

How do I create a fileWatcher with an onFileChange event using spawn?

2017-08-25 Thread Enjoys Math via Digitalmars-d-learn
Something like this: module file_watcher; import std.concurrency; import std.file; import std.signals; import std.datetime; void fileWatcher(Tid tid, string filename, int loopSleep) { auto modified0 = timeLastModified(filename); while (true) { modified =

Is it possible to generate a pool of random D or D inline assembler programs, run them safely?

2017-07-18 Thread Enjoys Math via Digitalmars-d-learn
Without them crashing the app running them? Say by wrapping with try / catch? You can assume that I've limited the opcode addresses to the program and/or the data section which I'll try to put right next to the code. Reason is so I don't have to make my own VM. I want to mutate computable

Re: How do I cast to from byte[] <-> double for making a small assembler language VM to work?

2017-07-18 Thread Enjoys Math via Digitalmars-d-learn
Thanks for the replies. I will look at 3-address opcodes and consider unions. *Wonders if it matters that Program is a struct with opSlice / opSliceAssign overloaded*.

How do I cast to from byte[] <-> double for making a small assembler language VM to work?

2017-07-18 Thread Enjoys Math via Digitalmars-d-learn
class OpCode { private: byte[] bytes_; public: void opCall(Program program) const; byte[] bytes() const { return bytes_.dup; } } class AddD : OpCode { private: uint d, s; public: this(uint dst, uint src) { d =

D doesn't read the first character of a file (reads everything but the first chararacter) with either read() or readText()

2017-07-17 Thread Enjoys Math via Digitalmars-d-learn
DMD32 D Compiler v2.074.1 import std.file; void main() { string bigInput = readText("input.txt"); } The file is 7 MB of ascii text, don't know if that matters... Should I upgrade versions?

Re: Yesterday Visual D worked, today it does not!

2017-07-17 Thread Enjoys Math via Digitalmars-d-learn
On Monday, 17 July 2017 at 17:57:14 UTC, Enjoys Math wrote: I made a console app the other day and there were build options present. In the build options I had to specify the dmd2 executable directly. Then it worked (but that's another error). Today there are no build options! I tried

Yesterday Visual D worked, today it does not!

2017-07-17 Thread Enjoys Math via Digitalmars-d-learn
I made a console app the other day and there were build options present. In the build options I had to specify the dmd2 executable directly. Then it worked (but that's another error). Today there are no build options! I tried creating a regular console app and a GDC/DMD console app.

Re: How to get rid of const / immutable poisoning (and I didn't even want to use them...)

2017-05-22 Thread Enjoys Math via Digitalmars-d-learn
On Monday, 22 May 2017 at 20:12:56 UTC, Enjoys Math wrote: I had to employ const / immutable to some things to get passed some compiler errors. Then the poisoning continues. How do I get this code to run? String's will hold a T[] which actually will not be modified by the String methods

Re: How to get rid of const / immutable poisoning (and I didn't even want to use them...)

2017-05-22 Thread Enjoys Math via Digitalmars-d-learn
On Monday, 22 May 2017 at 20:12:56 UTC, Enjoys Math wrote: I had to employ const / immutable to some things to get passed some compiler errors. Then the poisoning continues. How do I get this code to run? String's will hold a T[] which actually will not be modified by the String methods

How to get rid of const / immutable poisoning (and I didn't even want to use them...)

2017-05-22 Thread Enjoys Math via Digitalmars-d-learn
I had to employ const / immutable to some things to get passed some compiler errors. Then the poisoning continues. How do I get this code to run? String's will hold a T[] which actually will not be modified by the String methods ("immutable strings of T"). I did not want to use any

Re: How do you call hashOf() on a string?

2017-05-22 Thread Enjoys Math via Digitalmars-d-learn
Changing @safe to @system worked. IDK, but w/e! ;-)

How do you call hashOf() on a string?

2017-05-22 Thread Enjoys Math via Digitalmars-d-learn
module smallest_grammar; import std.conv; import std.algorithm; struct Symbol(T) { public: this(T sym, bool isVar) { this.sym = sym; this.is_var = isVar; } @property T symbol() { return sym; } @property bool isVar() { return

Re: Getting DUB to work with VS 2017

2017-05-22 Thread Enjoys Math via Digitalmars-d-learn
On Monday, 22 May 2017 at 06:44:27 UTC, Rainer Schuetze wrote: On 22.05.2017 03:54, Enjoys Math wrote: [...] C:\Users\Gabe\AppData\Roaming\dub\packages\pyd-0.9.9\pyd\\infrastructure\windows\python27_digitalmars.lib+ user32.lib+ kernel32.lib/NOMAP/CO/NOI/DELEXE LINK : fatal error LNK1181:

Re: Getting DUB to work with VS 2017

2017-05-21 Thread Enjoys Math via Digitalmars-d-learn
On Monday, 22 May 2017 at 01:49:48 UTC, Enjoys Math wrote: I did `dub generate visuald project_name`. VS 2017 loads the .sln file except for red 'x's on the dub.json files. My dub.json file looks like (if it matters): { "name": "pegparser", "targetName": "PEGparser",

Getting DUB to work with VS 2017

2017-05-21 Thread Enjoys Math via Digitalmars-d-learn
I did `dub generate visuald project_name`. VS 2017 loads the .sln file except for red 'x's on the dub.json files. My dub.json file looks like (if it matters): { "name": "pegparser", "targetName": "PEGparser", "authors": [ "Fruitful Approach" ],

Re: How can I implement this in D: a variant array of varying function pointer types (diff number of args or types)

2017-01-17 Thread Enjoys Math via Digitalmars-d-learn
On Tuesday, 17 January 2017 at 10:49:14 UTC, Enjoys Math wrote: Z add(Z...)(Z a...) { return a + b; } func[] operatorPool = [!int]; Variant library isn't liking that. Removing & causes another error. Essentially I want a pool of all operators that I define, but these operators can

How can I implement this in D: a variant array of varying function pointer types (diff number of args or types)

2017-01-17 Thread Enjoys Math via Digitalmars-d-learn
Z add(Z...)(Z a...) { return a + b; } func[] operatorPool = [!int]; Variant library isn't liking that. Removing & causes another error. Essentially I want a pool of all operators that I define, but these operators can be of differing types (which I should be able to

Does D optimize sqrt(2.0)?

2016-02-10 Thread Enjoys Math via Digitalmars-d-learn
If I just type out sqrt(2.0) in D, is that automatically made into a constant for me? Thanks.

How do you reference variables in an AA of Variants?

2016-02-08 Thread Enjoys Math via Digitalmars-d-learn
This: double b = 1.0; Variant[string] aa = ["b": ]; writeln(aa["b"]); fails with: Error: cannot implicitly convert expression(["b":]) of type double*[string] to VariantN!20u[string] Helps please!

What is a short, fast way of testing whether x in [a, b]?

2016-02-07 Thread Enjoys Math via Digitalmars-d-learn
Right now I'm using a logical ||: if (!(2*PI - EPS!float <= t1-t0 || t1-t0 <= 2*PI + EPS!float)) { But I'll be doing this a lot, so was wondering if there's a D native way of doing it. Thanks.

Re: What is a short, fast way of testing whether x in [a, b]?

2016-02-07 Thread Enjoys Math via Digitalmars-d-learn
On Monday, 8 February 2016 at 02:47:24 UTC, Enjoys Math wrote: Right now I'm using a logical ||: if (!(2*PI - EPS!float <= t1-t0 || t1-t0 <= 2*PI + EPS!float)) { But I'll be doing this a lot, so was wondering if there's a D native way of doing it. Thanks. Currently I have: @property T

How do you pass in a static array by reference?

2016-02-07 Thread Enjoys Math via Digitalmars-d-learn
I have several class members: Arc[4] arcs; Arc[4] arcs_2; and Id like to initialize them with the same function, so how do I "pass them in" by reference?

Re: How do you take the address of a struct in D?

2016-02-05 Thread Enjoys Math via Digitalmars-d-learn
On Friday, 5 February 2016 at 23:53:15 UTC, Enjoys Math wrote: SDL_RenderCopy(...) takes two pointers to SDL_Rect's, I have a property method in another class returning the SDL_Rect equivalent of a Box (my structure). Taking ampersand on the left of a call to the property does not give the

How do you take the address of a struct in D?

2016-02-05 Thread Enjoys Math via Digitalmars-d-learn
SDL_RenderCopy(...) takes two pointers to SDL_Rect's, I have a property method in another class returning the SDL_Rect equivalent of a Box (my structure). Taking ampersand on the left of a call to the property does not give the address (&).

"Error: need 'this' for 'bbox' of type 'Bong!(double, 3u)'"

2016-02-05 Thread Enjoys Math via Digitalmars-d-learn
I'm getting that on the last line of this code: auto wh = Vec2([loadSurf.w, loadSurf.h]); wh /= 2; auto x = wh.plus1Dim(pos[Z]); this.bbox = Box3(pos - x, pos + x); Any ideas?

Re: "Error: need 'this' for 'bbox' of type 'Bong!(double, 3u)'"

2016-02-05 Thread Enjoys Math via Digitalmars-d-learn
On Saturday, 6 February 2016 at 04:41:26 UTC, Enjoys Math wrote: I'm getting that on the last line of this code: auto wh = Vec2([loadSurf.w, loadSurf.h]); wh /= 2; auto x = wh.plus1Dim(pos[Z]); this.bbox = Box3(pos - x, pos + x);

Re: std.signals crashes GtkD gui application when SpinButton tied to signal.

2016-02-04 Thread Enjoys Math via Digitalmars-d-learn
On Friday, 5 February 2016 at 06:52:11 UTC, Enjoys Math wrote: I have two spin buttons connected to the width and height of 2d objects in a scene. Using mixin std.signals.Signal!(double, double) dimentionChanged; and there is a growing delay that happens not caused by the rendering

std.signals crashes GtkD gui application when SpinButton tied to signal.

2016-02-04 Thread Enjoys Math via Digitalmars-d-learn
I have two spin buttons connected to the width and height of 2d objects in a scene. Using mixin std.signals.Signal!(double, double) dimentionChanged; and there is a growing delay that happens not caused by the rendering code, the transform code, or the triggering code (I used a timer

Re: How do you get a hexstring from a base10 string -or- from a number?

2016-02-03 Thread Enjoys Math via Digitalmars-d-learn
On Wednesday, 3 February 2016 at 23:43:45 UTC, Enjoys Math wrote: I am making a method called: @property string debugIDString() { in { assert(super.toHash() == this.toHash()); } body { } body { // is currently: return to!string(this.toHash()); } and is returning a base10 string, so how

How do you get a hexstring from a base10 string -or- from a number?

2016-02-03 Thread Enjoys Math via Digitalmars-d-learn
I am making a method called: @property string debugIDString() { in { assert(super.toHash() == this.toHash()); } body { }

Re: How do you get a hexstring from a base10 string -or- from a number?

2016-02-03 Thread Enjoys Math via Digitalmars-d-learn
On Wednesday, 3 February 2016 at 23:45:15 UTC, Enjoys Math wrote: On Wednesday, 3 February 2016 at 23:43:45 UTC, Enjoys Math wrote: I am making a method called: @property string debugIDString() { in { assert(super.toHash() == this.toHash()); } body { } body { // is currently: return

How do you check if object o has base type B?

2016-02-03 Thread Enjoys Math via Digitalmars-d-learn
Consider: class C { } class B : C { } class A : B { } class D : C { } C[] objList; how do we test if objLis[k] is of base type "B"? Ie for [new A(), new B(), new D(), new C()] would give output [true, true, false, false]. ? Thank you! :D

How would you implement this in D? (signals & slots)

2016-02-01 Thread Enjoys Math via Digitalmars-d-learn
module signals_and_slots; import std.algorithm: remove; struct Slots(DelegateType, ArgTypes...) { this() { } // How would you implement this? void call(ArgTypes args) { foreach (dg; delegates) dg(args); }

Re: How would you implement this in D? (signals & slots)

2016-02-01 Thread Enjoys Math via Digitalmars-d-learn
On Monday, 1 February 2016 at 21:40:45 UTC, Enjoys Math wrote: module signals_and_slots; import std.algorithm: remove; [...] D's signals & slots: https://dlang.org/phobos/std_signals.html

How do you get system time in specified precision?

2016-02-01 Thread Enjoys Math via Digitalmars-d-learn
That is in metric system units? Ie milli-, micro-, hectanano-, nano-seconds? The documentation doesn't show this well and many things are deprecated. Please show me how! Thank you.

How do you do a typeid(obj) to get the most derived class that it is, or string?

2016-02-01 Thread Enjoys Math via Digitalmars-d-learn
class A { } class B : A { } class C : B { } auto b = new B(); typeid(b) == "B" ? Thanks.

Re: Unterminated format specifier exception keeps occuring and I don't know why.

2016-01-31 Thread Enjoys Math via Digitalmars-d-learn
On Sunday, 31 January 2016 at 19:51:34 UTC, Enjoys Math wrote: On Sunday, 31 January 2016 at 19:40:15 UTC, Enjoys Math wrote: This weird exception keeps occuring and visual D is not bringing me to the place in my code that might be calling it. [...] The exception is not listed in the

Unterminated format specifier exception keeps occuring and I don't know why.

2016-01-31 Thread Enjoys Math via Digitalmars-d-learn
This weird exception keeps occuring and visual D is not bringing me to the place in my code that might be calling it. Message: First-chance exception: std.format.FormatException Unterminated format specifier: "%" at C:\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(830) I've gotten rid

Re: Unterminated format specifier exception keeps occuring and I don't know why.

2016-01-31 Thread Enjoys Math via Digitalmars-d-learn
On Sunday, 31 January 2016 at 19:40:15 UTC, Enjoys Math wrote: This weird exception keeps occuring and visual D is not bringing me to the place in my code that might be calling it. [...] The exception is not listed in the Exception Settings checkable list. I will try commenting out the D

How do you initialize a class instance which has static storage within another class?

2016-01-30 Thread Enjoys Math via Digitalmars-d-learn
class A { static B b; } class B {} doing b = new B() does NOT work. Nor could I create a this() {} at module level

Re: How do you initialize a class instance which has static storage within another class?

2016-01-30 Thread Enjoys Math via Digitalmars-d-learn
On Saturday, 30 January 2016 at 21:52:20 UTC, Enjoys Math wrote: class A { static B b; } class B {} doing b = new B() does NOT work. Nor could I create a this() {} at module level More info: B : A so I can't do class A { this () { if (b is null) { b = new B(); } } }

To cast a uint to float to compute k/n, use to! or cast()?

2016-01-29 Thread Enjoys Math via Digitalmars-d-learn
I want to compute the points of a regular polygon in a loop: float r = 1.0; for (uint k=0; k < numVerts; k++) { vertlist ~= Vec2D(r * cos(k/n * 2 * PI), ...) } How do I make sure k/n is a float or double?

Computing the min() / max() of a slice of doubles.

2016-01-29 Thread Enjoys Math via Digitalmars-d-learn
I want to use std.algorithm.min/max, how would I apply that to a slice of doubles and not a tuple of args? Thanks.

  1   2   >