Re: unique index

2018-03-22 Thread Dippo
@mashigan & @miran Ty guys, you both point me to tables and i also thought that tables would solve my problem. I thought that tableref would reference the content like record number. But it reference the whole table. The point is that i want to prevent to walk through the whole table to see if

Re: Error: module names need to be unique per Nimble package;

2018-03-22 Thread domogled
thank very match. I think, that correct path is touch src/moje/a/a.nimble touch src/moje/b/b.nimble It works.

Re: Is there any way to create template with await?

2018-03-22 Thread dom96
Yes, you can do this: template withDb(body: untyped) = let dbFut = open(...) yield dbFut let db = dbFut.read() defer: close(db) block: body

Re: Error: module names need to be unique per Nimble package;

2018-03-22 Thread dom96
The compiler uses a .nimble file in a similar way as Python uses the __init__.py files. To fix your issue you can just: touch src/moje/a.nimble touch src/moje/b.nimble Should work then.

Re: unique index

2018-03-22 Thread miran
Maybe I'm misunderstanding the question, but to me this looks like a case where you would want to use [tables](https://nim-lang.org/docs/tables.html) instead of seq.

Re: unique index

2018-03-22 Thread mashingan
But maybe wrapped to `TableRef` is better I guess instead of seq if you need to have unique key

Re: unique index

2018-03-22 Thread mashingan
implement proc `==` and `contains` for you specialized type import sequtils type DataBuffer* = tuple key : string mytype : string value : string proc `==`(a, b: DataBuffer): bool = a.key ==

unique index

2018-03-22 Thread Dippo
Hi all, I have a problem finding a solution for a problem (or perhaps i am looking the wrong direction). I want to check if a key is already set and if that is the case, overwrite it with the new value. Off course there is the possibility to walk through the whole sequence to see if a key

Re: How to cross-compile a Nim executable for Android

2018-03-22 Thread yglukhov
@alexsad, take a look at [https://github.com/yglukhov/android](https://github.com/yglukhov/android)

Re: Arbitrary Precision Integer Math Operators

2018-03-22 Thread jzakiya
OK, so core Nim doesn't have an arbitrary precision math capability. Is it something planned for in the roadmap to 1.0?

Re: How to cross-compile a Nim executable for Android

2018-03-22 Thread alexsad
thanks a lot mashingan! It is working! Now I am going to implement JNI to call java classes(some SDK has been already developed in Java) for manage android application.

Error: module names need to be unique per Nimble package;

2018-03-22 Thread domogled
If I have two modules with the same name in differrent directory, I get compile error **Error: module names need to be unique per Nimble package;** tree . ├── moje.nimble ├── src │ ├── moje │ │ ├── a │ │ │ └── x.nim │ │ └── b │

Re: Compiling nim/ui in linux

2018-03-22 Thread frogEye
Araq I checked again to see if that issue exist but now I am not able to replicate it. It happend when I was setting up my workspace in a new linux machine. Cant say for sure wt happened but it does work now.

Re: How to call a macro from a template with a constructed identifier argument?

2018-03-22 Thread Lando
@mratsim: The code needs two changes to work: import macros macro defthing(name: untyped): untyped = # used this instead of parseStmt result = quote do: let `name` = 1000 # Now things get really weird: added a dummy argument and things work as

Re: Arbitrary Precision Integer Math Operators

2018-03-22 Thread mratsim
At Status we require that for cryptographic work and we are developing and supporting the following: * nim-ttmath: [https://github.com/status-im/nim-ttmath](https://github.com/status-im/nim-ttmath). This wraps the [ttmath C++ bignum library](https://www.ttmath.org/). This requires the

Re: How to call a macro from a template with a constructed identifier argument?

2018-03-22 Thread mratsim
Normally to do identifier construction of variable you need to use `{.inject.}` However untyped macro will capture everything and you will have to deal with the inject pragma in your macro. Instead forget about the template and do identifier construction directly in it. import

Re: Arbitrary Precision Integer Math Operators

2018-03-22 Thread lscrd
To add to Stephan's answer, I have tried both packages when solving puzzles from "Euler project": * "bigints" is pure Nim and has the best API in my opinion, but it is about twice slower than "bignum" and has some issues (see comments in source); it is still a work in progress. * "bignum"

Re: Passing data prom one thread to another

2018-03-22 Thread zolern
It is not Nim specific problem, you know, it is in general GUI "problem". In my practice the best way to send some data (and when I say "data" I mean "more than DWORD value") to UI is to save that data in some temporary container and use "message to ui" just to say "Hi, here is some data for

Re: Arbitrary Precision Integer Math Operators

2018-03-22 Thread Stefan_Salewski
Are the nimble packages bignum and bigints not good enough for you? I think one is a wrapper, the other is pure Nim from smart Mr. Felsing.

Arbitrary Precision Integer Math Operators

2018-03-22 Thread jzakiya
I have Ruby/Crystal code that uses arbitrary precision integer numbers (really BIG numbers). Looking at Nim's math libraries they don't appear to be arbitrary precision.

Passing data prom one thread to another

2018-03-22 Thread adamlevine
Passing data prom one thread to another Hi, I have created a process that's runing a thread that open some windows form, now i want that other running threads from the same process will be able to pass data to this windows form or even close it or reopen it. The Windows form GUI is always in

Re: How to call a macro from a template with a constructed identifier argument?

2018-03-22 Thread rpowers
Yes, that compiles, but the macro produces the code let x = 1000 instead of the code let xExtra = 1000 I'm trying to get the identifier to be constructed before passing it into the macro, but I'm not sure if that's possible.