Re: Help with Matrix concept

2018-04-06 Thread planhths
mratsim: try the code in the beginning and you will see the same error I'm getting. Jama actually uses seq[seq[float]] for storage. But this representation will be better right? Well [here](https://gist.github.com/notTito/aaeb00ef41c3c56c0e3bf2e3c2a7bc29) are some benchmarks I made to test

Re: Twinprimes generator that showcases Nim

2018-04-06 Thread jzakiya
`UPDATE`, mostly more tweaking of `proc twins_sieve`. Tried different loop structures|idioms to see what would be faster (`for` vs `while` loops mostly, etc). Made some cosmetic, line order changes. Code `version 2108/04/05` more compact, a little more cleaner, with little more clearer comments

Re: Help with Matrix concept

2018-04-06 Thread mratsim
This should works. if you have `a, b` Nim expects both to resolve to the same AnyMatrix and the same T. An example is `a, b: SomeInteger` versus `a: SomeInteger, b: SomeInteger` proc op[T:SomeReal](a: AnyMatrix[T], b: AnyMatrix[T]): AnyMatrix[T] = ... Alternatively you can

Re: Help with Matrix concept

2018-04-06 Thread planhths
mratsim: the problem I'm having is: Error: type mismatch: got when using the same as your last snippet. On the other hand splitting the types in the proc parameters would allow Matrix[Complex] * Matrix[float] which we don't want. The libraries you posted are

Re: Help with Matrix concept

2018-04-06 Thread mratsim
Generics are enough: type Matrix[T: SomeReal] = object rows, cols: int data: seq[T] Transposed[T: SomeReal] = distinct Matrix[T] AnyMatrix[T: SomeReal] = Matrix[T] or Transposed[T] proc op[T:SomeReal](a, b:

Re: Help with Matrix concept

2018-04-06 Thread planhths
The manual mentions "By default, during overload resolution each named type class will bind to exactly one concrete type. We call such type classes bind once types." so what I am trying is not possible? Can someone confirm?

Re: Help with Matrix concept

2018-04-06 Thread planhths
mratsim: thanks! I was already using that one, but it requires proc signatures to look like: proc op(a: AnyMatrix, b: AnyMatrix): Matrix could concepts be usefull in this case so I can restrict to only i.e. `a: AnyMatrix[float] and b: AnyMatrix[float]`?

Re: how to find symbol definition on cmd line? can nimsuggest help?

2018-04-06 Thread timothee
thanks, indeed examples would help. here's a start: echo sug import_all.nim | nimsuggest --hints:off --stdin import_all.nim > all.txt followed by fast queries: grep pattern all.txt this is already very useful but to support queries like in the OP without

Re: how to use compiler/nimeval: execute ? getting: Error: cannot 'importc' variable at compile time

2018-04-06 Thread timothee
thanks, filed [https://github.com/nim-lang/Nim/issues/7522](https://github.com/nim-lang/Nim/issues/7522)

Re: Help with Matrix concept

2018-04-06 Thread mratsim
Here you go type Matrix = object rows, cols: int data: seq[float] Transposed = distinct Matrix AnyMatrix = Matrix or Transposed Note that instead of transposed you probably want to use column-major or row-major (or

Re: Warning: parseopt2 is deprecated

2018-04-06 Thread mratsim
I had good experience with Cligen: [https://github.com/c-blake/cligen](https://github.com/c-blake/cligen)

Re: Help with Matrix concept

2018-04-06 Thread planhths
miran: thanks, but I 'm not reinventing anything I was porting a another lib to nim.

Re: Help with Matrix concept

2018-04-06 Thread miran
If you're working with matrices (and don't want to re-invent everything by yourself), I can recommend using Neo: [https://github.com/unicredit/neo](https://github.com/unicredit/neo)

Help with Matrix concept

2018-04-06 Thread planhths
Hello, bellow is a zero copy transpose function for matrices. What I was trying to do is have a concept which satisfies Matrix or Transpose but also checks for the type, so later I can have a Matrix[T] type. Any help would be appreciated. type AnyMatrix = concept m, var

Re: how to find symbol definition on cmd line? can nimsuggest help?

2018-04-06 Thread Araq
Nimsuggest is documented here: [https://nim-lang.org/docs/nimsuggest.html](https://nim-lang.org/docs/nimsuggest.html) Unfortuantely it still lacks examples, PRs are welcome.

Re: how to use compiler/nimeval: execute ? getting: Error: cannot 'importc' variable at compile time

2018-04-06 Thread Araq
`compiler/eval` needs to setup the VM environment properly. A regression.

Re: could Nim benefit from upcoming C++ modules to speedup compilation times?

2018-04-06 Thread Araq
> on a small project Yes, and things change for big projects.

Re: Can I write games with Nim for Android?

2018-04-06 Thread mashingan
check this excellent module, [https://github.com/yglukhov/android](https://github.com/yglukhov/android)

Re: could Nim benefit from upcoming C++ modules to speedup compilation times?

2018-04-06 Thread timothee
@amalek @cblake > if you want to speed up compile times you can use tcc unfortunately tcc doesn't work on OSX, see [https://github.com/wheineman/nrpl/issues/16](https://github.com/wheineman/nrpl/issues/16) besides, this would come at a cost of runtime performance (but would still be good for

Re: [RFC] use `when predef.os.macosx` instead of `when defined(macosx)` ; more robust and scalable

2018-04-06 Thread Araq
[https://nim-lang.org/docs/nimc.html#additional-compilation-switches](https://nim-lang.org/docs/nimc.html#additional-compilation-switches)

Re: Memory usage skyrocketed with nim 0.18.0 (in my async tcp service test)

2018-04-06 Thread aguspiza2
I am thinking about bisecting it now that I have a simple test. Also now I have a Dockerfile to bootstrap any commit FROM alpine RUN apk add --no-cache g++ curl tar git RUN git clone https://github.com/nim-lang/Nim.git; RUN cd Nim; \ git clone --depth 1

Re: [RFC] use `when predef.os.macosx` instead of `when defined(macosx)` ; more robust and scalable

2018-04-06 Thread timothee
> Enum are mutually exclusive but you can create predefined sets from the enums. using this? [https://nim-lang.org/docs/manual.html#types-set-type](https://nim-lang.org/docs/manual.html#types-set-type) is there any code using it for defined(...) ? > Regarding compile-time defines, my main