Hello,
I'm trying to create a dictionary of templated function pointers.
The functions should return `bool` and take a differently-typed
dynamics arrays `T[]` as an argument. Based on my understanding
of the docs, I've made two failed attempts:
**Attempt 1**:
https://github.com/PhilippeSig
On Saturday, 10 September 2022 at 22:13:01 UTC, frame wrote:
On Saturday, 10 September 2022 at 00:24:11 UTC, jwatson-CO-edu
wrote:
Hello,
I'm trying to create a dictionary of templated function
pointers. The functions should return `bool` and take a
differently-typed dynamics arrays `T[]` as
Hello,
I used the following steps to build the example `raylib-d`
program. (https://github.com/schveiguy/raylib-d#example)
### Install Raylib (Ubuntu/Debian)
1. `sudo apt install libasound2-dev mesa-common-dev libx11-dev
libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev`
1. `c
On Wednesday, 14 September 2022 at 23:42:57 UTC, Steven
Schveighoffer wrote:
On 9/14/22 4:17 PM, jwatson-CO-edu wrote:
Hello,
I used the following steps to build the example `raylib-d`
program. (https://github.com/schveiguy/raylib-d#example)
### Install Raylib (Ubuntu/Debian)
1. `sudo apt ins
I have an implementation of the "[Little
Scheme](https://mitpress.mit.edu/9780262560993/the-little-schemer/)" educational programming language written in D, [here](https://github.com/jwatson-CO-edu/SPARROW)".
It has many problems, but the one I want to solve first is the
size of the "atoms" (un
I just pushed a D implementation of "[Little
Scheme](https://mitpress.mit.edu/9780262560993/the-little-schemer/)", which is a limited educational version of [Scheme](https://en.wikipedia.org/wiki/Scheme_(programming_language)), to [GitHub](https://github.com/jwatson-CO-edu/SPARROW).
_Here I woul
On Thursday, 17 November 2022 at 21:05:43 UTC, H. S. Teoh wrote:
Question:
**Where do I begin my consolidation of space within `Atom`?
Do I use
unions or variants?**
In this case, since you're already keeping track of what type
of data is being stored in an Atom, use a union:
stru
On Thursday, 17 November 2022 at 21:19:56 UTC, Petar Kirov
[ZombineDev] wrote:
On Thursday, 17 November 2022 at 20:54:46 UTC, jwatson-CO-edu
wrote:
I have an implementation of the "[Little
Scheme](https://mitpress.mit.edu/9780262560993/the-little-schemer/)" educational programming language writt
On Thursday, 17 November 2022 at 22:49:37 UTC, H. S. Teoh wrote:
Just create a nested anonymous struct, like this:
struct Atom {
F_Type kind;
union { // anonymous union
struct {
Atom* car; /
On Saturday, 19 November 2022 at 03:38:26 UTC, jwatson-CO-edu
wrote:
Thank you, something similar to what you suggested reduced the
atom size from 72 bytes to 40.
Oh, based on another forum post I added constructors in addition
to reducing the atom size 44%.
```d
struct Atom{
F_Type kin
On Saturday, 19 November 2022 at 19:16:41 UTC, Jack Pope wrote:
On Thursday, 17 November 2022 at 22:05:45 UTC, jwatson-CO-edu
wrote:
[`Atom`](https://github.com/jwatson-CO-edu/SPARROW/blob/main/lil_schemer.d#L66)
(unit of data), I throw it on the heap and never bother to delete it. [...]
If
On Monday, 21 November 2022 at 14:36:43 UTC, Paul Backus wrote:
On Thursday, 17 November 2022 at 22:05:45 UTC, jwatson-CO-edu
wrote:
* Compatibility with both Windows and Linux. What do I need to
consider?
- Can I create threads/processes under Windows?
[core.thread][1] and [std.process][2]
On Tuesday, 22 November 2022 at 08:19:44 UTC, JG wrote:
On Thursday, 17 November 2022 at 22:05:45 UTC, jwatson-CO-edu
wrote:
I just pushed a D implementation of "[Little
Scheme](https://mitpress.mit.edu/9780262560993/the-little-schemer/)", which is a limited educational version of [Scheme](https
Hello,
I have this small [gamepad input test
program](https://github.com/jwatson-CO-edu/nanoverse/blob/main/d/raylib/04_jsInput/source/app.d). In the program, I poll the first 3 gamepad IDs, but all detection attempts return `false`. I know that my gamepad is an Xinput model. I have tried star
On Wednesday, 30 November 2022 at 23:18:33 UTC, ryuukk_ wrote:
On Wednesday, 30 November 2022 at 22:46:52 UTC, jwatson-CO-edu
wrote:
Hello,
I have this small [gamepad input test
program](https://github.com/jwatson-CO-edu/nanoverse/blob/main/d/raylib/04_jsInput/source/app.d).
Which OS and wich
Is there a way to write a single statement that creates a void
pointer that points to an initialized float array? See below:
```d
float* arr = cast(float*) new float[4];
arr[0] = 0.1;
arr[1] = 0.1;
arr[2] = 0.1;
arr[3] = 0.1;
void* value = cast(void*) arr;
```
I am attempting to recreate the [Raylib flat shading
tutorial](https://www.raylib.com/examples/shaders/loader.html?name=shaders_basic_lighting) with raylib-d. I have been able to find most of the necessary wrappers except the one the creates light sources. How do I create light sources in raylib-
On Thursday, 1 December 2022 at 00:47:18 UTC, Adam D Ruppe wrote:
On Thursday, 1 December 2022 at 00:39:21 UTC, jwatson-CO-edu
wrote:
Is there a way to write a single statement that creates a void
pointer that points to an initialized float array?
float[] f = [1,1,1];
some_function_taking_vo
On Thursday, 1 December 2022 at 01:12:17 UTC, Steven
Schveighoffer wrote:
On 11/30/22 7:28 PM, jwatson-CO-edu wrote:
On Wednesday, 30 November 2022 at 23:18:33 UTC, ryuukk_ wrote:
On Wednesday, 30 November 2022 at 22:46:52 UTC,
jwatson-CO-edu wrote:
Hello,
I have this small [gamepad input tes
On Thursday, 1 December 2022 at 21:34:41 UTC, Steven
Schveighoffer wrote:
On 12/1/22 11:10 AM, ryuukk_ wrote:
Can you try with this page:
https://www.raylib.com/examples/core/loader.html?name=core_input_gamepad
Does it detect your gamepad?
It should work because the `IsGamepadAvailable` func
On Thursday, 1 December 2022 at 22:16:30 UTC, jwatson-CO-edu
wrote:
That was the trick, [inside the loop it detects the
gamepad](https://github.com/jwatson-CO-edu/nanoverse/blob/main/d/raylib/04_jsInput/source/app.d#L35). No other changes needed.
I have a new problem:
Raylib-d [can see all 6 g
On Thursday, 1 December 2022 at 01:17:16 UTC, Steven
Schveighoffer wrote:
On 11/30/22 7:56 PM, jwatson-CO-edu wrote:
uint MAX_LIGHTS = 4;
The rlights header file is not part of the raylib library, but
is in the examples directory, you will need to port it. It's
not very big, you probably can
On Friday, 2 December 2022 at 01:03:47 UTC, Steven Schveighoffer
wrote:
It's important to remember that raylib-d doesn't do any special
things with the raylib functions -- they are just straight
calls into the library.
-Steve
Indeed, I plugged a different gamepad into the same system
runnin
I am confused about why Program 1 produces random output but
Program 2 does not.
---
### Program 1
```d
import std.stdio;
import std.conv;
import std.random;
Mt19937 rnd;
double rand01(){
// Uniform random sampling in [0,1)
return uniform( 0.0, 1.0, rnd);
}
void main(){
rnd = Ran
On Thursday, 22 December 2022 at 17:33:48 UTC, Paul Backus wrote:
So, as far as I can tell, there is nothing wrong with your
code, and the random number generator is working as intended.
Most likely you have made a mistake somewhere in the part of
the code that you did not post, and that mista
On Friday, 23 December 2022 at 00:58:01 UTC, Steven Schveighoffer
wrote:
Without the rest of the code, and how random is called, I have
a hunch... Are you using threads by any chance?
If, for instance, your calls to rand01 are done in a new
thread, that new thread will have a *default* state o
On Friday, 23 December 2022 at 07:25:23 UTC, Salih Dincer wrote:
You can try using static this.
```d
import std.random;
static this() { } // can try using
Mt19937 rnd;
void init_random() {
rnd = Random(unpredictableSeed);
}
double rand01() {
return uniform(0, 1.0, rnd);
}
void main()
{
On Friday, 23 December 2022 at 00:00:06 UTC, H. S. Teoh wrote:
You could try using DustMite to reduce it to a minimal (or at
least
smaller) example.
My personal guess is that you forgot a `ref` somewhere when you
pass the RNG to a function. Given that due to historical
accident std.random us
On Friday, 23 December 2022 at 07:25:23 UTC, Salih Dincer wrote:
You can try using static this.
```d
import std.random;
static this() { } // can try using
Mt19937 rnd;
void init_random() {
rnd = Random(unpredictableSeed);
}
double rand01() {
return uniform(0, 1.0, rnd);
}
void main()
{
On Friday, 23 December 2022 at 17:53:24 UTC, H. S. Teoh wrote:
You probably should give DustMite a shot; from the snippets
you've posted so far we haven't found any clues of what might
have gone wrong. To narrow down the issue we really need to
start from the original code and reduce it to a mi
On Saturday, 24 December 2022 at 16:42:36 UTC, Siarhei Siamashka
wrote:
Sounds like a case of https://xkcd.com/221/
BTW, you don't need to explicitly initialize unpredictableSeed,
Another thing is that the current implementation of
`std.random` in Phobos is extremely slow
Even better, I aut
On Saturday, 24 December 2022 at 16:34:29 UTC, Ali Çehreli wrote:
static this() blocks: executed when a thread a starts (the
program has at least one thread: the main thread); so you can
put initializations here
~static this() blocks: counterparts of 'static this', executed
once for each thre
On Sunday, 25 December 2022 at 14:47:49 UTC, Siarhei Siamashka
wrote:
Just in case if you are not joking, caching a certain amount of
dice rolls to reuse them later in a circular fashion would make
a bad quality pseudorandom number generator (a slightly
upgraded version of the xkcd joke). Don't
Hi,
I am trying to create a struct with a settable method that has
access to the struct scope.
Is this the only way?
Is there a way to give access without explicitly passing `this`?
```d
import std.stdio;
struct TestStruct{
float /*--*/ a;
float /*--*/
On Sunday, 22 January 2023 at 02:28:11 UTC, ryuukk_ wrote:
```D
TestStruct ts = {
a: 2, b: 3,
op: (s) {
return s.a + s.b;
}
};
```
This simple! just like with C's designated initializers
Ah, I had forgotten about this handy initializer form! However
On Monday, 30 January 2023 at 07:48:09 UTC, Salih Dincer wrote:
On Saturday, 21 January 2023 at 23:07:45 UTC, jwatson-CO-edu
wrote:
I am trying to create a struct with a settable method that has
access to the struct scope.
Is this the only way?
Is there a way to give access without explicitly p
I have the following directory structure:
```
ANN/
ANN/mathkit/
ANN/mathkit/package.d
ANN/utils/
ANN/utils/package.d
ANN/MLP.d
```
I have the following in "ANN/mathkit/package.d":
```d
module ANN.mathkit;
//...
/// Local Imports ///
import ANN.utils;
//...
```
I have
On Tuesday, 14 February 2023 at 17:56:39 UTC, ryuukk_ wrote:
I think you need to do:
```
rdmd MLP.d -I ANN/
```
Basically you need to tell the compiler where your imported
packages are
This did the trick. I did not need it when `utils` was the only
local import, but I suppose the compiler
I read a file into a `ubyte` buffer as shown:
```d
\\ ...
buffer = cast(ubyte[]) read( fName ); // Read the entire file as
bytestring
marker = 0; // Current index to read from, managed manually, :(
\\ ...
```
The data file contains numbers of varying size, and I want to
read them sequentially
On Thursday, 16 March 2023 at 18:58:18 UTC, ag0aep6g wrote:
On Thursday, 16 March 2023 at 18:39:00 UTC, jwatson-CO-edu
wrote:
```d
int rtnVal = buffer.peek(int,Endian.bigEndian)(&marker);
// Error: found `,` when expecting `.` following int
```
You just forgot the exclamation mark there.
"th
40 matches
Mail list logo