`collections.heapqueue` does mostly what you want. You would have to remove
duplicates yourself, like below, but probably with an iterator called something
like `unique`.
import collections.heapqueue
var heap = newHeapQueue[int]()
let data = [1, 3, 5, 1, 7, 9, 2, 4,
The Nim language support was added in the annual championship in AI
programming: [RussianAICup](http://russianaicup.ru/?locale=en)
The task of this year is to create AI for simplified real time strategy.
You can write your own AI strategy in Nim and test it using the developers kit
from the
I'm trying to do something like this:
type
ThreadID* = distinct uint8
Msg*[T] = object
sender*: ThreadID
receiver*: ThreadID
previous: pointer#ptr[Msg[any]]
content*: T
let space = alloc0(sizeof(Msg[int]))
let m =
Thanks to @hawk_king I get get koch to compile. However, bootstrapping nim
fails:
./koch boot -d:release
gives me an error:
CC: compiler_nim
Error: invocation of external compiler program failed. File exists
I have bunch of ints that I need to insert into set and read in increasing
order avoiding duplicates. They are produced at a different time so I don't
have them in a seq.
I can probably knock-up a quick SortedSeq as a distinct seq in my code. I have
a good capacity estimate for my sue case, so
import strtabs, json
#let b:seq[StringTableRef] = @[]
let b = newStringTable()
echo %*{"a":10,"b":b}
fails with
lib/pure/json.nim(760, 36) template/generic instantiation from here
lib/pure/json.nim(772, 14) template/generic instantiation from here
I will use this container for Tensors/multidimensional arrays.
It already scales almost perfectly with the number of cores through OpenMP: 4
cores --> 3.5x (reduce operations like sum) to 4x speedup (map and element-wise
operations like matrix addition).
So for now, it's like this, assuming
Thank you very much for the information. I just tried it with Nim version
0.17.0 and there the behavior is exactly as described in the documentation.
It turns out I had an old nim compiler in my path that was getting used instead
of 0.17.2. Once I removed the old compiler, everything works as expected. Case
closed.
@Araq Happy to hear that!
Could you elaborate about the main thread being the only one being able to
create and destroy the objects? It sounds quite restrictive so I'd like to hear
what your motivation and the general idea was.
You are wrong.
nodejs package? Does it mean Nim is to be compiled on JS backend for Android or
am I wrong (please say I'm wrong)?
This was changed in 0.17.2 and sadly the docs were not updated.
You need to wrap it in a component in order for this to work. Look at
tests/components.nim for a somewhat messy example.
Hej all,
I am new here and new to the language. In essence I am playing around to get
familiar with NIM.
Currently, I am trying to reproduce the example on JavaScript invocation from
the documentation, see [JavaScript invocation
@Araq This is awesome library to develop single page applications.
I need to develop some page together with a js api library for maps (e.g: here
maps, google maps or open street map) and one div element works as a map
container into it map library generates map tiles, map objects and so on. Is
After exploring various designs for a container (Tensor) which only copy memory
when necessary (shallow `let` and deep `var`, using the GC refcount) and
hitting technical roadblocks. I've settled on this one. Note that this should
work nicely with the future `=move` and `=sink` operator:
Please, ensure that your executable is also 64-bit.
Maybe the calling conventions differ. This usually results in different name
mangling rules and so could cause an error like yours.
Hello,
I'm trying to use this glfw wrapper:
[https://github.com/ephja/nim-glfw](https://github.com/ephja/nim-glfw). I clone
the repo, enter the examples directory, and execute nim c -r minimal.nim, just
as the documentation provides. Compilation succeeds, great! Now I attempt to
run
21 matches
Mail list logo