Advent of Nim 2020 megathread

2020-12-10 Thread xigoi
I think we should have a `deltas`/`increments` function in the stdlib, since it's just the opposite of `cumsum` (which we already have) and often useful

Question about dup syntax

2020-12-10 Thread Hlaaftana
pnt1.mirror(pnt2) var pnt4 = pnt1 pnt4.mirror(pnt2) Run This is exactly what dup does.

Ideal design for a general purpose SparseSet?

2020-12-10 Thread jackhftang
If performance is the primary concern (regardless ease of use, functionalities, etc), then I think benchmark is the only criterion to tell the truth. I made a [test](https://github.com/jackhftang/bench_sparseset) to compare the performance between Table, SparseSet and adix/DITab. I didn't test e

Library for making lightweight Electron-like HTML/JS GUI applications

2020-12-10 Thread Niminem
Thanks for the feedback, I'll be updating the readme to include more details on those kinds of things. Currently, it doesn't have the functionality to package the app for you. That'll be shipped in 0.3.0 in January. The binaries are very tiny though. For now, a Neel app opens in a chrome brows

Ideal design for a general purpose SparseSet?

2020-12-10 Thread cblake
I'm for flexibility. I wrote `adix/ditab` for that reason. Realistic relative performance expectations can _also_ be good and/or shift priorities. :-)

Ideal design for a general purpose SparseSet?

2020-12-10 Thread Araq
> TL;DR is I'd bet you could probably get by with regular Nim Table to start. > Could be wrong. Just trying to help/maybe simplify things. I can't say I agree. Writing a custom container for the use case seems to be a good idea even if it's in the end not any faster. We cannot simply use Table

Question about dup syntax

2020-12-10 Thread jrfondren
Somehow very, very few languages allow your preferred syntax. Ada's one: with Text_IO; use Text_IO; procedure Example is function F return String is ("Hello, world!"); function F return Integer is (111); begin Put_Line (F); Put_Line (Integer'Im

Question about dup syntax

2020-12-10 Thread mantielero
I am using `dup` for the first time: pnt1.mirror(pnt2) var pnt4 = pnt1.dup(mirror(pnt2)) # <--- A bit ugly Run Any idea about how to make the second line better looking? For me it would be nice if the following was possible: pnt1.mirror(pnt2) v

Ideal design for a general purpose SparseSet?

2020-12-10 Thread cblake
@jackhftang \- that link you shared is literally exactly `adix/ditab`. I didn't think it similar to lrucache, but just was not sure what @b3liever really wanted until he shared that entity component system (ECS) skypjack link which both seem to be about video games. Direct indexing is neat and

collect for seq[set[int8]]

2020-12-10 Thread doofenstein
this works as well: import sugar let s = collect(newSeq): for i in 0..2: set[int8]({}) Run or import sugar let s = collect(newSeq): for i in 0..2: var x: set[int8] # do some kind of operation on x x

collect for seq[set[int8]]

2020-12-10 Thread elcritch
Wow I didn't know you could assign types like that. Handy! But oh, that could be abused by unscrupulous people, including myself.

cpp2nim.py - c++ bindings

2020-12-10 Thread mantielero
I am glad it served you somehow. I updated it with a couple of corrections.

lint+ - an improved linter for the lite text editor, incl. Nim support

2020-12-10 Thread Araq
Note that `nim c` can run file system operations at compile-time and editors are **strongly adviced** to use `nim check` instead. If the error messages are too bad, please try `nim check --errormax:1`.

Ideal design for a general purpose SparseSet?

2020-12-10 Thread jackhftang
umm since I was mentioned, bear with me few sentences... I don't know much about sparse set, but after I read [this

Ideal design for a general purpose SparseSet?

2020-12-10 Thread b3liever
>From the looks it, I have misunderstood the problem, should have implemented a >slot map and not a sparse set from the beginning.

Ideal design for a general purpose SparseSet?

2020-12-10 Thread b3liever
> I have no experience with this slotmap thing you refer to, It's a specialized data-structure used in games (Indeed they even refer to it as `esoteric` :P) but it has the advantage that data are laid out flat in memory. I have trouble generalizing

lint+ - an improved linter for the lite text editor, incl. Nim support

2020-12-10 Thread lqdev
I'm proud to announce that I've released lint+, a linter for [lite](https://github.com/rxi/lite). It actually started out as a Nim-only linter, but I decided to distill it to something a bit more generic with a separate Nim support plugin. You can grab lint+ from its GitHub repository:

Ideal design for a general purpose SparseSet?

2020-12-10 Thread cblake
I have no experience with this `slotmap` thing you refer to, but it may be relevant to point out @jackhftang's [lrucache](https://github.com/jackhftang/lrucache.nim). (That duplicates key storage. A linked-list hash collision strategy is the usual workaround for that.) Anyway, I don't mean to

Ideal design for a general purpose SparseSet?

2020-12-10 Thread b3liever
Glad we have you to judge things but again thank you very much!

Ideal design for a general purpose SparseSet?

2020-12-10 Thread b3liever
> And even that isn't robust to very obscure needs. And a lot of things "are > obscure but should not be!" > ¯_(ツ)_/¯ I honestly don't know how obscure is my project, but the problems arise from the fact I'm using a `slotmap` data-structure to recycle deleted entities and other stuff needs to b

Ideal design for a general purpose SparseSet?

2020-12-10 Thread cblake
It's true that we might want `ditab` to restrict key types to be unsigned8/16/32 bit ints for safety (but this can create API frictions). Anyway, I am happy to make specific updates/take PRs, but this thread has gone from its highly general sounding topic to even more general fusion questions to

Is there a way to monitor the total memory usage of a Nim app?

2020-12-10 Thread Serge
Thank you!

Is there a way to monitor the total memory usage of a Nim app?

2020-12-10 Thread Serge
Thank you!

Ideal design for a general purpose SparseSet?

2020-12-10 Thread Araq
> To be honest, I'm not sure what fusion is really for. This is the first I've > heard "peer review" being even a relevant adjective for it. It is reviewed code that follows the same design principles as the stdlib and can be seen as a "staging" area for the stdlib. That said, it started out as

collect for seq[set[int8]]

2020-12-10 Thread HJarausch
Thanks!

Ideal design for a general purpose SparseSet?

2020-12-10 Thread b3liever
Well, ditab doesn't cut it for my use-case. Thank you very much for all for trying to help I will check your stuff out!

Is there a way to monitor the total memory usage of a Nim app?

2020-12-10 Thread Serge
Is there a way to monitor the total memory usage of a Nim app like for Golang?

Is there a way to monitor the total memory usage of a Nim app?

2020-12-10 Thread lqdev
There are some procs in system that may be helpful: * *

thread vscode error juste is normal

2020-12-10 Thread JPLRouge
thank you that reassures me I will be able to put my project on github I made webview and websoket an assembly that allows to have an interactive browser including dynamic socket reassignment I admit having given webview a serious boost on both the. h that .nim, as for the websocket I purified

Ideal design for a general purpose SparseSet?

2020-12-10 Thread cblake
Well, ok. But, there's nothing stopping anyone from opening issues or discussions over at the [adix repo](https://github.com/c-blake/adix) to peer review it. Discoverability is always a challenge. The bigger the stdlib or fusion become the more they will have the discoverability problems the (n

Is there a way to monitor the total memory usage of a Nim app?

2020-12-10 Thread spip
Have you looked at [Nim Memory Profiler](https://nim-lang.org/docs/estp.html)?

Ideal design for a general purpose SparseSet?

2020-12-10 Thread b3liever
I think it's better if stuff like this existed in fusion, because you can implement the same concepts with a thousand different ways, but something peer reviewed would be better.

thread vscode error juste is normal

2020-12-10 Thread Hlaaftana
Most editor plugins use `nim check`, and `nim check` can sometimes give errors a normal compilation wouldn't give. It might also be the case that to compile your program you use something like `-d:ssl`, but the `nim check` command might not use it, so some modules might break when using `nim che

thread vscode error juste is normal

2020-12-10 Thread JPLRouge
hello: I have no compilation error object, the program works perfectly my "webview" server "websocket" works perfectly with the possibility of being treated like a normal browser of course I added a lot of function in webview and resize but errors in vscode vscode import websoc

fusion/SharedPtr why []= sig undefined?

2020-12-10 Thread ggibson
Okay, thanks; I'll submit a PR.

Ideal design for a general purpose SparseSet?

2020-12-10 Thread cblake
Cool. Of course, you may actually use the `DISet*[K] = DITab[K,void]` defined there if you do not need satellite data, but your post/question here assumed it { but called it a "set" :-) }. As with the other `adix` tables I try to provide the superset of set-like and table-like ops with a few ext

Advent of Nim 2020 megathread

2020-12-10 Thread pietroppeter
always interesting to see other approaches! not sure what you mean about the global pragma or DP (?), but if it is a spoiler for others you can avoid (or delay) answering. :) also, as a disclaimer to my hints, they do follow very closely my approach and a few other approaches are possible (poss

Ideal design for a general purpose SparseSet?

2020-12-10 Thread b3liever
`adix/ditab` is very similar, thanks

Ideal design for a general purpose SparseSet?

2020-12-10 Thread cblake
Not sure if you are aware of [adix](https://github.com/c-blake/adix) which has `adix/ditab` that is along these lines, or `adix/lptabz` in "ordered mode" which uses `adix/sequint` to achieve pretty close to maximum memory density, but one or more of the ideas there may be helpful to you (if the

Advent of Nim 2020 megathread

2020-12-10 Thread jackhftang
For today (day 10), I found that if proc `-`[T](a,b: openArray[T]): seq[T] Run is prepared, the solution of part 1 can be expressed in a clean way. I think it maybe useful in the future also. proc main() = let input = readFile(inputFilePath).strip

Ideal design for a general purpose SparseSet?

2020-12-10 Thread b3liever
Also, how to fit `sparseset` to the implicit initialization style used in Nim? `sparse` ideally needs to be allocated with `maxValues`, so seems impossible?

Ideal design for a general purpose SparseSet?

2020-12-10 Thread mratsim
It seems like what you call SparseSets is not what I call Sparsesets. but maybe my implementations are just specialization with 0..https://github.com/mratsim/golem-prime/blob/8953347/src/datatypes.nim#L105-L118> * Code:

Ideal design for a general purpose SparseSet?

2020-12-10 Thread b3liever
I have seen your implementation before! So the difference is I need iteration of key,value pairs.

collect for seq[set[int8]]

2020-12-10 Thread b3liever
`import sugar type x = set[int8] let s = collect(newSeq): for i in 0..2: x({}) ` Run

Ideal design for a general purpose SparseSet?

2020-12-10 Thread b3liever
Hi, I have been meaning to rewrite my sparseset implementation and publish it as a package. However a lot of design decisions are over my head. Specifically the objects structure, would a single seq holding key, value pairs be preferable over separate ones? This is similar to the design of `std.

Advent of Nim 2020 megathread

2020-12-10 Thread Mohitvermaji51
this is really understandable...thanks for sharing with us...

collect for seq[set[int8]]

2020-12-10 Thread HJarausch
I don't understand **collect**. Given type BS8 = set[int8] var S = collect(newSeq) : for i in 0..2 : {} # how can specify which type of set, e.g. BS8, here? Run Unfortunately this doesn't work var S = collect(newSeq[BS8]) : ...

Advent of Nim 2020 megathread

2020-12-10 Thread pietroppeter
for those who are struggling with today (day 10) part2, I published a series of hints:

any way to extra version info from .nimble file?

2020-12-10 Thread dom96
As far as I'm concerned the solution @SolitudeSF posted is the best one: > you can define `const NimblePkgVersion {.strdefine.} = ""` to access this > information when building with nimble. Why use anything else? Placing the version in a separate .nim file and then importing it from the .nimbl

any way to extra version info from .nimble file?

2020-12-10 Thread jiyinyiyong
> an include file that both your code uses and is included in the `.nimble` file didn't know nimble file can use `import`, but as I tried I can't figure out how to import from a relative path. do you have an example? only example I found is importing a package

fusion/SharedPtr why []= sig undefined?

2020-12-10 Thread cdome
I agree `sp[] = 12` should work. We can add `[]=` operator to mimic deref assingment.

fusion/SharedPtr why []= sig undefined?

2020-12-10 Thread Araq
I think it's an oversight, please create a PR and add the `[]=` operation.