hardware-software interaction in Nim

2023-12-05 Thread kobi
Hi guys, I have initial thoughts on connecting a small drone to a computer console-like system, programming in Nim, and sending messages to it, not via the hardware controller, but via the software. it could be several drones, maybe send them tasks to perform. From a software design perspective,

How to make a generic type parameter be late bound for evaluating proc parameter types?

2023-12-05 Thread Pylgos
In this case you can use type aliases. template IntToStr(t: typedesc): auto = when t is int: string else: t type IntToStrTy[T] = IntToStr(T) proc test[T](t: IntToStrTy[T]) = discard test[int]("") Run

2nd level parameter typing

2023-12-05 Thread sls1005
Is a procedural type whose parameter list contains a generic type also a generic type? i.e. Can the following procedure take a `proc(x: int)` or `proc(x: float)` as callback, or does it take exactly a `proc(x: int | float)`? proc f(g: proc(x: int | float)) = discard

How to create local packages

2023-12-05 Thread ggb-sw1
Up until now, the little coding I have done with Nim has had all shared code in a single directory, and using a --path=... in the nim.cfg file for the project. This is clearly not a very scalable (nor particularly idiomatic) solution to sharing code between projects, so I am looking to put the v

CBOR?

2023-12-05 Thread elcritch
Note it looks like you don't have a nimble file? That'd make the library hard to use. :)

CBOR?

2023-12-05 Thread elcritch
Awesome! I'll have to take a look. Does it support extended types?

Advent of Nim 2023

2023-12-05 Thread mig
Here are my solutions: \- you'll need to redirect stdin to run the examples, e.g. `./build/day4 < input/day4` I'm using AoC to learn Nim better. Day 5 part 2 is slow, I'm sure there's a trick with all the affine tran

Advent of Nim 2023

2023-12-05 Thread mig
I would suggest looking at some other solutions. Taking more than 1s for day 4 suggests your solution is inefficient. I would suggest profiling/timing your code or sections of your code to see where the bottleneck is. My solution for day4 part 1 & 2 in a debug build takes <0.02s on my machine.

Advent of Nim 2023

2023-12-05 Thread mig
Here are my solutions: you'll need to redirect stdin to run the examples, e.g. `./build/day4 < input/day4` I'm using AoC to learn Nim better. Day 5 part 2 is slow, I'm sure there's a trick with all the affine transfo

Enu 0.2

2023-12-05 Thread dsrw
I just added [discussions](https://github.com/dsrw/enu/discussions) to the github repo. If anyone has support requests, or general comments that don't fit here, please ping me there or on [Discord](https://discord.gg/BWHUs4Wc).

Enu 0.2

2023-12-05 Thread dsrw
Thanks for the feedback. I really appreciate it. I'll have to do more "non happy path" testing for prototypes. It sounds like you were instancing a prototype that was instancing a prototype, which should work of course, but none of my demos actually do that so it must have broken at some point.

Object variant - returning different types

2023-12-05 Thread dwhall256
If you turn your variant variable into a const, you could get close to what you want using a template for the math operator. But this is probably not what you really want.: type MyVariant = object case kind: bool of true: intValue: int of fals

Understanding the Ingredients of Smart Hemp Gummies Australia

2023-12-05 Thread sarahbrak
Smart Hemp Gummies Australia:- The first step in getting started with Smart Hemp Gummies Australia is to choose the type of gummies that you would like to try. With a variety of flavors available, there's sure to be something for everyone. Facebook @

Infiltrating Rust with Nim packages

2023-12-05 Thread Clonk
Congratulation @mratsim. It would be great, if you have the time and will, to explain your choice of Nim over Rust for this package. I'm curious to hear the reasoning of creating a Nim-based Rust package instead of using Rust directly.

Enu 0.2

2023-12-05 Thread moigagoo
Here's the second part of my terrain generation quest: This time, I'm generating trees to the terrain so that it's hard to see through and makes it interesting to sneak around monsters.

Enu 0.2

2023-12-05 Thread moigagoo
> I'm really curious to hear where the pain points are Honestly, the biggest for me so far has been stability. Enu crashes from time to time. I've noticed this much likely to happen when I use prototypes. * In general, working with prototypes is something I'm not digging yet. I like the idea

Infiltrating Rust with Nim packages

2023-12-05 Thread mratsim
Reporting back, Infiltration successful, we can now accelerate slow Rust with fast Nim ;) * Description: * nimble needs to check the `OUT_DIR` env variable to put the libraries in the correct place:

What would I lose if I turn of garbage collection?

2023-12-05 Thread mratsim
This is probably the largest Nim library written with manual memory management: * * See allocators: That said for core cryptography, it's all stack objec

Capture atomics in closure

2023-12-05 Thread mratsim
Atomics means you can update them concurrently (solving race conditions) but that's orthogonal to ownership (solving data races). You need to capture its address

Object variant - returning different types

2023-12-05 Thread mratsim
If the return type is the same for all variants, I have a macro for this error, scroll to the bottom for a minimal example: If the return type is not the same you need to pass it as

CBOR?

2023-12-05 Thread icedquinn
I just finished rewriting mine this evening