Re: Looking for a set that sorts and deduplicates

2017-11-22 Thread cblake
`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,

RussianAICup2017 now supports Nim!

2017-11-22 Thread xomachine
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

Pointer to generic type with unspecified generic parameter?

2017-11-22 Thread monster
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 =

Re: Nim on Android

2017-11-22 Thread sdwfrost
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

Looking for a set that sorts and deduplicates

2017-11-22 Thread cdome
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

Unable to jsonify stringtable(s)

2017-11-22 Thread random898989
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

Re: Copy-on-write container

2017-11-22 Thread mratsim
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

Re: JavaScript invocation example Documentation vs. Code?

2017-11-22 Thread HelgeCPH
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.

Re: Cannot get glfw-nim to work

2017-11-22 Thread drsneed
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.

Re: Nim on Android

2017-11-22 Thread Udiknedormin
@Araq Happy to hear that!

Re: Copy-on-write container

2017-11-22 Thread Udiknedormin
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.

Re: Nim on Android

2017-11-22 Thread Araq
You are wrong.

Re: Nim on Android

2017-11-22 Thread Udiknedormin
nodejs package? Does it mean Nim is to be compiled on JS backend for Android or am I wrong (please say I'm wrong)?

Re: JavaScript invocation example Documentation vs. Code?

2017-11-22 Thread Araq
This was changed in 0.17.2 and sadly the docs were not updated.

Re: Introducing the Karax framework

2017-11-22 Thread Araq
You need to wrap it in a component in order for this to work. Look at tests/components.nim for a somewhat messy example.

JavaScript invocation example Documentation vs. Code?

2017-11-22 Thread HelgeCPH
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

Re: Introducing the Karax framework

2017-11-22 Thread alexsad
@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

Copy-on-write container

2017-11-22 Thread mratsim
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:

Re: Cannot get glfw-nim to work

2017-11-22 Thread cheatfate
Please, ensure that your executable is also 64-bit.

Re: Cannot get glfw-nim to work

2017-11-22 Thread Araq
Maybe the calling conventions differ. This usually results in different name mangling rules and so could cause an error like yours.

Cannot get glfw-nim to work

2017-11-22 Thread drsneed
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