Can't instantiate generic in some cases

2023-04-30 Thread alexeypetrushin
Wonder why `Table[string, string].init` doesn't work in default arg initialisation? import std/tables proc init*[K, V](_: type[Table[K, V]]): Table[K, V] = discard proc somefn(_: type[string], params = Table[string, string].init) = discard echo

fetching data from many small .txt files

2023-04-30 Thread ingo
Depending on what you do with the data, store them in SQLite (or Spatialite if the coordinates are geographical).

Windows AsyncSocket bindAddr() fails for TCP Client sockets

2023-04-30 Thread hgxz
Hi Everyone, I believe there is a bug in the Windows implementation of asyncnet. I cannot specify a source IP or source port using bindAddr() for use in a TCP client. An extract of the problem code is below: import asyncdispatch, asyncnet import net proc client() {.asy

help cleaning up a complex type

2023-04-30 Thread ElegantBeef
type RegisterType* = uint8 | uint16 | uint32 RegisterPtr* = ptr RegisterType RegisterAttr = enum Readable, Writable RegisterAttrs = set[RegisterAttr] NimbedConfig = object RegisterConfig[ TAddress: static RegisterPtr, T

help cleaning up a complex type

2023-04-30 Thread dwhall256
I'm trying to create a type to represent a microcontroller register where the address of the register is part of the type. This is the closest I can get to what I want that will compile: type RegisterType* = uint8 | uint16 | uint32 RegisterPtr* = ptr RegisterType

fetching data from many small .txt files

2023-04-30 Thread alexeypetrushin
May worth to try a) use async b) use caching, so you don't have to process those files every time.

Nimwave - build TUIs for the terminal, web, and desktop

2023-04-30 Thread Nlits
Do you have some basic starter code? The example repo is extremely confusing and feels like a project someone would work on for a few months, not an example.

fetching data from many small .txt files

2023-04-30 Thread cmc
Seems like a good use-case for my LimDB. It's a table-like interface to a mature key-value database based on memory-mapped files . For smallish strings, this is usually a lot faster than file access because once the data is loaded the first time round, your code won't be doing calls to the kerne

fetching data from many small .txt files

2023-04-30 Thread cblake
I suspect there may be system settings to optimize small file IO on Windows 10, but I am not the person to ask and that is actually not very Nim-specific. I will observe that 3,000 lines of 40-ish byte lines is like 120 KiB or 30 virtual memory pages which may not be what everyone considers "sma

fetching data from many small .txt files

2023-04-30 Thread tcheran
Hi, I was wondering if there is a way to optimize this kind of data processing. I'm using Windows 10, and I need to parse many relatively small .txt files and rearrange their content in a table, where table index is a pair of 2D grid coordinates and table value is a sequence of strings. The orde

Can I quick get table last key value use like at(idx) function?

2023-04-30 Thread cblake
FWIW, this should already work in [adix](https://github.com/c-blake/adix) in compact-insertion-ordered mode [lptabz](https://github.com/c-blake/adix/blob/master/adix/lptabz.nim#L708). The data will not be very predictable if you start doing any deletes, but @Angluca's use case sounds very stati

Can I quick get table last key value use like at(idx) function?

2023-04-30 Thread planetis
Since this is an often requested feature, do you plan on releasing it at some point? Or if you need help finishing it I'll volunteer!

Data structure creation help.

2023-04-30 Thread rjjBJonU
I tried to implement the code from this article. Roll Your Own Autocomplete Solution Using Tries But I can't create the recursive data structure. Just an idea of what to use from the standard library would help. Trie(object): def __init__(self,

Type binding generic alias with extra parameter

2023-04-30 Thread shirleyquirk
ok, it does work () on 1.6.12: type Foo[T]{.pure.} = object {.inheritable.} x:T Bar[T,R] = object of Foo[T] Run on devel type Foo[T]{.pure,inheritable.} = object x:T Bar[

Type binding generic alias with extra parameter

2023-04-30 Thread shirleyquirk
The solution I'm using right now is to add an unused counter static int parameter to Bar, and a CacheCounter that's incremented in `makeBar` it makes 2 `makeBar(int,float)`s distinct/dispatchable, but of course they are both `Bar` so all of Bar's api works This was straightforward only because

After upgrading to Nim 1.6.12, my tests generate a lot of warnings - how to address?

2023-04-30 Thread vsajip
It turns out that the warnings don't appear when I run the tests (having made no changes to my code) using > $ testament p "tests/test?.nim" I'm not sure if that's because Testament just swallows console output from a lower-level test runner, or because it runs the tests with that pragma.

Optimise async request / code [For Beginners]

2023-04-30 Thread enthus1ast
Well, you (maybe) can speed up network io when you request compressed html (which the std client cannot do). I've done a small wrapper that can do this, but it's also very easy to just build this into your own clients.