Re: How should I contribute documentation?

2018-08-03 Thread mratsim
Offtopic, you should tell that to those academics writing papers but not publishing their implementations :/

Re: Automatically convert C++ to C?

2018-07-31 Thread mratsim
I'm not sure this is relevant to Nim unless you want to go C++ --> Nim --> C. You can use [LLVM

Re: [best practice] we should use `check` or `require` instead of `echo` + `discard` magic in tests

2018-07-31 Thread mratsim
Can't we just overhaul unittest?

Re: strformat using a run-time defined format string

2018-08-05 Thread mratsim
strformat is using compile-time macro. For runtime have a look at formatFloat and formatBiggestFloat in [strutils](https://nim-lang.org/docs/strutils.html#formatBiggestFloat,BiggestFloat,FloatFormatMode,range%5B%5D,Char) General tips: you can use

Re: possible compiler bug with generics?

2017-10-28 Thread mratsim
Actually I think there is a difference between how types and procs are treated, I don't know if this is intentional. This compiles: types.nim type Foo* = distinct int proc toFoo*(x: int): Foo = Foo(x) lib.nim import types proc

Re: Success - calling custom CUDA kernels from Nim

2017-09-17 Thread mratsim
Actually there is an even simpler code that avoids having to copy the header to ./nimcache ([gist](https://gist.github.com/mratsim/ea8c3fe07aaeffd41a9bb7fbdf2a1d16)). Note: VScode and github properly highlight the emit. import nimcuda/[cuda_runtime_api, driver_types, nimcuda

Re: Nim newbie request/challenge

2017-09-04 Thread mratsim
to the first 10 problems](https://github.com/mratsim/nim-projecteuler) including a [fast packed bitarray-based Sieve of Eratosthenes](https://github.com/mratsim/nim-projecteuler/blob/master/lib_euler_primes.nim#L160) with OpenMP parallel loop. I compared it to Rosettacode sieves and primesieve

Re: Tutorials and documentation for a nim project

2017-07-08 Thread mratsim
tutorials. As a workaround, I include a .nim file [full of commentaries](https://github.com/mratsim/Arraymancer/blob/087b5c82addf90fd3a569364613e89b683f011a1/docs/autogen_nim_API.nim) * I cannot seem to display images this way. * [See source switch](https://nim-lang.org/docs/docgen.html#related-o

Macros as variable declaration pragmas

2017-11-05 Thread mratsim
I want to do the equivalent to the following but as a macro: `{.pragma: align64, codegenDecl: "$# $# __attribute__((aligned(64)))".}` Macros as pragmas for procs work fine, is it also available for variables? macro align64*(x: untyped): untyped = # expectKind(x, nnkIdent)

Re: Compiler crashes while compiling module with

2018-02-25 Thread mratsim
@monster, i see that you're using 0.17.2. I'm pretty sure this is solved on devel.

Re: Simple neural network written in Nim

2017-06-19 Thread mratsim
Perceptron based on Karpathy's "Neural network for hackers": [https://github.com/mratsim/nim-rmad/blob/master/examples/ex04_2_hidden_layers_neural_net.nim](https://github.com/mratsim/nim-rmad/blob/master/examples/ex04_2_hidden_layers_neural_net.nim) and I'm working hard to get a proper Nim tens

Re: Perfecting Nim

2018-04-22 Thread mratsim
* Dead code elim: make it the default * bitsets: No, I agree with the other posters they are super useful. I can squeeze lots of speed from them without thinking on how to reimplement bitvector, shifts, masking and all that jazz. * Exceptions. I think it really depends on the use case. I

Re: Nim's Easy Serialization Macro - new version available

2018-02-25 Thread mratsim
Congrats, it's a really well done package!

Re: Perfecting Nim

2018-04-24 Thread mratsim
Completing my first answer with tings that came up after: * `converters` currently are a bit unsafe. They can happily trigger ambiguous calls when a converter to numeric type exist. I don't mind them going especially if the int literals stuff is sorted out. Or it would be nice if we could

Re: Hacktoberfest project contributions?

2017-10-07 Thread mratsim
Arraymancer was born in-between linalg and neo and is targeted at machine learning, with a focus on deep learning and computer-vision (and later speech and language hopefully). I started Arraymancer because you need 4-dimensional tensors for deep learning on images (Number of images, RGB

Re: Why is Nim so slow in this

2018-05-16 Thread mratsim
Nim can be consistently faster than C++ with raw pointers. See: * [{.noInit.} PR](https://github.com/frol/completely-unscientific-benchmarks/pull/17) requires devel unfortunately * [Static compilation

Re: Copy-on-write container

2017-11-27 Thread mratsim
I'm not sure we are speaking of the same thing. In which case are we: a Tensor containing seqs or a pure rank 2 (matrix) or rank 3 tensor? import arraymancer import sequtils, random let p1 = newSeqWith(4, random(0..10)) let p2 = newSeqWith(4, random(0..10))

Re: problem with template (or types)(i think)

2018-01-24 Thread mratsim
I'm not really sure if I would consider that a bug. b is a bad name for a proc/template anyway. An ambiguous call might improve this though. this works: import sequtils type Color1 = array[1, int] Color2 = array[1, int] Color = Color1 | Color2

Re: Comparing AST symbols

2017-06-06 Thread mratsim
There was a topic with the following hasType proc you can check out. Here is how I use it to check if a variable is of type int The macro that calls that proc **must** be a **typed** macro. If you want to call from an **untyped** macro it will need to call the typed macro that will call the

Re: floating point output formating

2017-11-06 Thread mratsim
@jzakiya, you are right that Nim documentation could be improved. Especially theindex could be made more visible, like a link "Looking for a proc? Try theindex" on the website or the manual. If it exists it's probably not visible enough. Then, Nim has 2 core devs, and no one full-time on it.

Re: atomics: Why is interlockedCompareExchange8

2017-11-27 Thread mratsim
@Udiknedormin: I meant right now, since VTable are not available of course. @monster: It is not safe as is, you must ensure your chain of Msg and MsgBase pointers have the same lifetime (by putting them in a seq for example). Otherwise if they are created in different functions, the previous

Re: Nim versus Julia benchmark comparison

2017-12-19 Thread mratsim
Yes, it's to make sure that if the cpu governor is "ondemand", benchmarking starts with the CPU running at full speed and not at ~800Mhz for the first few iterations.

Re: Introducing loopfusion: loop over any number of sequences of any single type.

2018-03-20 Thread mratsim
Done import loopfusion let a = @[1, 2, 3] let b = @[11, 12, 13] let c = @[10, 10, 10] forEach x in a, y in b, z in c: echo (x + y) * z # 120 # 140 # 160 # i is the iteration index [0, 1, 2] forEach i, x in a, y in b, z in

Re: Nim vs D

2017-07-07 Thread mratsim
For me the killer feature is readability: no bracket, no semicolon. Also when reading other's Nim code, most of the code I see is really clean and in short self-contained functions.

Re: How do I read BMP file header directly to type?

2018-03-12 Thread mratsim
Also you might want to take into account the endianness of BMP.

Re: testing private methods in external module

2017-10-22 Thread mratsim
A bit meta to this topic but isn't it better to test only the public procedures? Otherwise if you test your private procs, they will hinder you while refactoring (limiting internal design) instead of helping you.

Re: Normalized AST presentation of the proc body

2017-07-05 Thread mratsim
You might be interested in my autograd library: [nim-rmad](https://github.com/mratsim/nim-rmad). It automatically compute the gradient of any function with regards to any of its input. It uses reverse-mode auto-differentiation behind the scene. let ctx = newContext[float32

Re: Closure iterators that yield mutable values

2017-05-25 Thread mratsim
As suspected, it's not possible to yield mutable values with a closure iterator as it would violate memory safety, similarly to this [github issue](https://github.com/nim-lang/Nim/issues/2361) The only efficient alternative to my current way is if we could actually chain inline iterators:

Re: Is this use of Nim locks correct?

2017-10-26 Thread mratsim
To be honest I don't know I never used volatile, but if your use case was multi-threading, I would follow Intel advice and find another portable way to sync memory/have memory fences.

Re: Structural typing hack PoC

2018-03-14 Thread mratsim
@StasB, the future VTable and vtptr and vtref are hidden [here](https://github.com/nim-lang/Nim/blob/c671356d51488c96b4749a4d109b00d924e1f739/doc/manual/generics.txt#L585-L639).

Re: Nim versus Julia benchmark comparison

2017-12-02 Thread mratsim
Idem for me on macOS with i5-5227U: Hint: operation successful (19122 lines compiled; 0.414 sec total; 22.422MiB peakmem; Release Build) [SuccessX] Hint: ./bin/sir [Exec] 0.060975 21.12 $ julia bin/sir.jl 0.063728 seconds (2.09 k allocations: 232.998 KiB)

Re: AOS and SOA library?

2017-09-09 Thread mratsim
Not exactly what you want but there is a port of GLM to Nim: [https://github.com/stavenko/nim-glm](https://github.com/stavenko/nim-glm)

Re: Arraymancer - A n-dimensional array / tensor library

2017-09-24 Thread mratsim
I am very excited to announce the second release of Arraymancer which includes numerous improvements `blablabla` ... Without further ado: * Communauty * There is a Gitter room! * Breaking * `shallowCopy` is now `unsafeView` and accepts `let` arguments * Element-wise

Re: floating point output formating

2017-11-08 Thread mratsim
>From a formatting point of view, please don't use the `code` syntax for bold, >it's painful to read. I think it's completely misplaced to criticize dom96 for not contributing to documentation, he took two years of his time to write an excellent book, make sure that his examples are useful and

Re: Arbitrary Precision Integer Math Operators

2018-03-24 Thread mratsim
I'm pretty sure it's not planned for 1.0. Now due to the need of arbitrary precision floating point arithmetic for currencies/finance at Status, we wrapped mpdecimal, available [here](https://github.com/status-im/nim-decimal). Now the wrapper is below low-level and overload like `+` must be

Re: Heterogeneous object pool with Timed Eviction

2017-11-12 Thread mratsim
to optimize memory usage without impacting accuracy. I did not came across this Rust allocators collection, great. All my Cuda Allocator research is detailed [there](https://github.com/mratsim/Arraymancer/issues/112)

Re: How to get the address of string

2018-05-09 Thread mratsim
This is shorter and a bit more clean in my opinion var a: cstring = "" let a_ptr = cast[ByteAddress](a) echo a_ptr

Re: ref object or object with ref field

2017-04-11 Thread mratsim
r field so my naive guess is that it doesn't matter in term of perf/memory. @Krux02, I'm using this "Context" object [here](https://github.com/mratsim/nim-rmad/blob/master/src/autograd.nim)

Re: Macros as variable declaration pragmas

2017-11-05 Thread mratsim
I guess we get spoiled with everything that is possible in Nim . I've submitted a feature request: [https://github.com/nim-lang/Nim/issues/6696](https://github.com/nim-lang/Nim/issues/6696)

Re: Help with Matrix concept

2018-04-07 Thread mratsim
function](https://unicredit.github.io/neo/#solving-linear-systems) and I added [least_squares equation solver](https://github.com/mratsim/Arraymancer/blob/master/tests/linear_algebra/test_linear_algebra.nim) to Arraymancer. If it's for learning use `seq[float]` instead of the seq of seq double

Re: What can we learn from the SO 2018 Dev Survey?

2018-03-15 Thread mratsim
You can't reply to questions that people don't ask, to get more people asking, we need to attract them. Also you might not need a REPL but you cannot generalize your case with the need of the millions of Python developers in the world. Besides you have to look beyond devs, scientists are also

Re: Looking for a set that sorts and deduplicates

2017-11-23 Thread mratsim
`insets` dedups for sure and seems extremely fast. I don't know if it's items is sorted though.

Re: Nim versus Julia benchmark comparison

2017-12-02 Thread mratsim
I can cut Nim code to 0.040 by using OpenMP: proc simulate():float64 = let parms: array[5,float64] = [2.62110617498984, 0.5384615384615384, 0.5, 403.0, 0.1] var seed: uint = 123 var r = initXorshift128Plus(seed) let tf = 540 let nsims = 1000

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: String procs, when to modify in place, when to return modified string, when to return boolean result

2017-10-05 Thread mratsim
mremovePrefix

Re: What's happening with destructors?

2017-11-06 Thread mratsim
@Araq, What are your thoughts about [epoch-based GC](https://aturon.github.io/blog/2015/08/27/epoch/) as crossbeam is doing for Rust to build a library of lock-free data structures

Heterogeneous object pool with Timed Eviction

2017-11-10 Thread mratsim
In the past 2 days I've been researching various ways to avoid expensive allocations/deallocations in tight loops on GPU, by reusing memory. Apparently this is also a recurrent issue in game programming so I'd like to share my approach and request for comments. My use-case: * I

Re: testing private methods in external module

2017-10-25 Thread mratsim
I don't considered unit tests harmful, I use them extensively in [Arraymancer](https://github.com/mratsim/Arraymancer/tree/master/tests/tensor) but I only tests what is public which is probably about 80% of the code because as a math library, only thing kept private is the boilerplate basically

Re: how to get unmodified / uninterpreted source code/AST of expression in macro?

2018-04-03 Thread mratsim
That's actually a regular question (pain point?) regarding macros. The current way is to preprocess using an untyped macro, and then dispatch/getAST from a typed macro when you need type resolution. I remember seeing some discussion to ease that but they are pretty buried.

How do you keep your motivation on your open-source projects

2017-10-26 Thread mratsim
I've been working on Arraymancer for 6 months now with ups and downs. This is my first big project (and actual the first time I'm developing "for real") and I would like to know how do you keep your energy for the long run. In my case, I seem to alternate between various modes: * "The

Re: Error: invalid indentation

2017-09-25 Thread mratsim
Nitpicking but just use the [SomeReal](https://nim-lang.org/docs/system.html#SomeReal) typeclass instead of this line: floatingPoint = float | float64 | float32 By the way, I don't really understand your need but you can usually go very far in Nim with just generics and

Re: Twinprimes generator that showcases Nim

2018-03-28 Thread mratsim
Congrats, that's really an achievement ! OpenMP is easy, you can use it like this, the following defines a new -d:openmp compilation flag: when defined(openmp): {.passC: "-fopenmp".} {.passL: "-fopenmp".} # Note: compile with stacktraces off or put # when

Re: generic proc not instantiated depending on calling syntax

2018-03-18 Thread mratsim
It's a known issue. It's hard to disambiguate "test".readMe[uint16]() with a bracket expression I suppose since at that time the compiler doesn't know if uint16 is a typedesc or an index I suppose. I think there is a RFC for that:

Re: Subtle memory management error found

2017-09-15 Thread mratsim
The only operator with this gotcha is < right? Maybe it would be best to just deprecate it. Is there unary >? By the way, Nim manual has a part with the discouraged syntax [here](https://nim-lang.org/docs/manual.html#generics-generic-concepts-and-type-binding-rules) proc

Re: Option type optimizations

2017-09-29 Thread mratsim
I'd love an Option[T] without overhead, was just looking for this. I'll just use "nil" for now but that would be better.

Nim image libraries

2017-07-18 Thread mratsim
I'm looking for a library to load and save images (PNG, JPEG ...) So far I saw: * [Nim-OpenCV](https://github.com/dom96/nim-opencv), no update since Nov. 2015 * [Nimage](https://github.com/haldean/nimage), no update since Aug. 2016 * [nimPNG](https://github.com/jangko/nimPNG), supported

Re: (Documentation Request) Nim and OOP

2017-12-23 Thread mratsim
Maybe add it to the cookbook project: [https://github.com/btbytes/nim-cookbook](https://github.com/btbytes/nim-cookbook)

Re: What's happening with destructors?

2017-11-09 Thread mratsim
Many microcontroller only have a stack so you just can't use heap . Also @Varriount, @Udiknedormin today you can do: type SharedArray[T] = object dataRef: ref[ptr T] data*: ptr UncheckedArray[T] len*: int proc deallocSharedArray[T](dataRef:

Re: Introducing loopfusion: loop over any number of sequences of any single type.

2018-03-23 Thread mratsim
I've updated the package, it now supports in-place mutation of the inputs and sequence of different subtypes as input. Here is a snippet of the syntax. import loopfusion block: # Simple let a = @[1, 2, 3] let b = @[11, 12, 13] let c = @[10, 10, 10]

Re: Any future for true associative arrays?

2017-09-03 Thread mratsim
Can't you use the [sets module](https://nim-lang.org/docs/sets.html) or maybe the [tables module](https://nim-lang.org/docs/tables.html) ?

Macros AST - Refactoring deep (4-level) nested if-elif-else statement.

2017-05-19 Thread mratsim
32| This is working fine, however my macro is a huge spaghetti monster (120 lines) of if, elif, else with lots of repetition to handle all the cases. Incriminated code is there: [https://github.com/mratsim/Arraymancer/blob/Slice-and-Dice/src/arraymancer/accessors_slicer.nim#L187](https:

Re: Closure iterators that yield mutable values

2017-05-25 Thread mratsim
Indeed ! First mistake. Now I have illegal capture var s = @[1, 2, 3, 4, 5] proc mvalues[T](s: var seq[T]): auto {.noSideEffect.}= return iterator(): var T = for val in s.mitems: yield val var mit = s.mvalues for i in mit():

Re: Copy-on-write container

2017-11-24 Thread mratsim
Ah right, indeed. Well let's say that it's a non-supported use case shrugs and that Arraymancer tensors are the wrong container for that. I'm not aware of any scientific/numerical computing situation with an operation depends not only on the tensor size but also the value of what is wrapped.

Re: Arbitrary Precision Integer Math Operators

2018-03-22 Thread mratsim
/numforge/number-theory) which is just a reorganization of code I've used for Project Euler ([my repo here](https://github.com/mratsim/nim-projecteuler)). Of note it will provide a template that replace all operations in a scope by modulo operation: import number_theory modulo

Re: Modules and circular shared types.

2017-11-28 Thread mratsim
Include also slows compilation, with a single change you must recompile more files. A third alternative is forward declaration. Declare just the type names in a single module but defer their implementation to other files.

Re: .. code-block:: nim

2017-09-20 Thread mratsim
Can you post a small snippet as example? Edit: code block needs indentation probably, check the manual or tutorial source. [https://github.com/mratsim/Arraymancer/blob/master/docs/autogen_nim_API.nim](https://github.com/mratsim/Arraymancer/blob/master/docs/autogen_nim_API.nim)

Re: Challenges implementing an "actor system" in Nim (long post!)

2017-10-30 Thread mratsim
I can't help you on that but go for it, awesome project! Don't forget to check how [Pony](https://www.ponylang.org/discover/#what-is-pony) does its actor system (the whole language is based on Actors). It's probably state of the art. In particular here are the papers (bibliography might be

Re: Is there way to just dump staticRead bytes to seq.

2017-11-18 Thread mratsim
If gz is enough, can it can be compressed through .gz instead of Snappy? Does Windows require an external decompressor for .gz as well?

Re: scope guards

2018-03-30 Thread mratsim
It's a post from 2013 . Anyway the idiomatic way to do scope guard is with a template that does try: body finally: as it's done by Udiknedormin [here](https://forum.nim-lang.org/t/3205/1#20223). There is an example in the [guards and lock

Re: Stein's (binary) GCD algorithm (iterative version)

2018-03-17 Thread mratsim
Relevant [Handbook of Applied Cryptography](http://cacr.uwaterloo.ca/hac/about/chap14.pdf) on page 17 of the this chapter 14 PDF (page 606 - chapter 14.4 of the whole book) It has the binary GCD, extended binary GCD and Lehmer's GCD algorithm.

Re: Copy-on-write container

2017-11-27 Thread mratsim
In which cases would you need to store a seq or a list in a tensor or a Numpy ndarray?

Re: Another reason to deprecate ..

2017-10-04 Thread mratsim
To be honest I also find ... Ruby syntax illogical (not a Rubyist, coming from Python) Triple dot are probably a source of silent bugs that are also harder to catch in code reviews. Also I think ..< better convey the meaning of mathematical exclusive range [a, b[ vs inclusive [a, b] Now

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

Introducing loopfusion: loop over any number of sequences of any single type.

2018-03-18 Thread mratsim
After diving deep in the wonderful world of metaprogramming today, I'm happy to share the [loopfusion](https://github.com/numforge/loopfusion) package. For now you need to install it through `nimble install https://github.com/numforge/loopfusion`. This will give you 2 macros forEach and

Re: [RFC] List comprehension replacement and syntax

2018-02-08 Thread mratsim
I'm surprised no one replied to your thread yet. The goal is to have "for" be a expression so it could sit on the right-hand side of an assignment. I'm not sure how it will be in practice for the: initialization - for loop - return

Re: Hacktoberfest project contributions?

2017-10-04 Thread mratsim
@perturbation, Thanks for your interest. Many of the low hanging fruits in Arraymancer are done but I could use your help in implementing reduction functions like "max", "min", and in-place functions like msqrt, msin, as mentioned here: [https://github.com/mratsim/Arrayman

Re: Linear algebra library

2017-06-08 Thread mratsim
I've been scratching my head a lot for my tensor library between using the default seq value semantics or ref/shallowCopy. For now I'm using the default seq value semantics at least until benchmarks or usage shows that it poses a memory/performance issue. Here are the relevant Nim quotes:

Choosing a specific overload of `==`

2018-07-18 Thread mratsim
You need to use another name like isSameInstance (or even === or <=> but it's less clear): type Person = ref object of RootObj name: string # define "value-equality" for Person type proc `==`(x,y: Person): bool = x.name == y.name # define

Re: Is this use of Nim locks correct?

2017-10-26 Thread mratsim
@Rayman2220 @wizzardx I had shared memory issue in OpenMP at one point in Arraymancer (solved since then). I just checked volatile and from this [Intel post](https://software.intel.com/en-us/blogs/2007/11/30/volatile-almost-useless-for-multi-threaded-programming), it says that there is no

Re: Negative generic type matching

2017-10-23 Thread mratsim
Example [here](https://github.com/mratsim/Arraymancer/blob/master/src/tensor/higher_order.nim#L190) GC types mess up OpenMP, so I need 2 versions of each higher-order functions: with no-GC allocation and with GC allocation in the end result (and no OpenMp) proc map2*[T, U; V

Re: What can we learn from the SO 2018 Dev Survey?

2018-03-15 Thread mratsim
Didn't try it yet, but is that a REPL is 140 lines of code? [https://github.com/AndreiRegiani/INim](https://github.com/AndreiRegiani/INim)

Re: testing private methods in external module

2017-10-26 Thread mratsim
Argh indeed.

Re: nim-ffmpeg wrapper: how to continue?

2017-11-02 Thread mratsim
What will you use it for? If it's to manipulate video data, preprocess, trim, filter it (convolution, denoising, etc), it might be much easier to use [ffms2](https://github.com/FFMS/ffms2) Or maybe provides bindings to Avisynth (Windows-only) or

Re: atomics: Why is interlockedCompareExchange8 "safe"?

2017-11-27 Thread mratsim
Also could concepts fit your need?

Re: Subtle memory management error found

2017-09-15 Thread mratsim
I see that you are using the pairs iterator followed by a if condition in the Nim code. Can you check without? so that it's more in line with the C++ code? for j, prime in primes: # for each prime r1..sqrt(N) if nextp[row + j] < uint(Kn): # if 1st mult resgroup

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

2018-04-05 Thread mratsim
Enum are mutually exclusive but you can create predefined sets from the enums. Regarding compile-time defines, my main issue is that a lot are hidden. There is this wiki documentation:

Re: Compiler crash when pointers to generics from template

2018-03-12 Thread mratsim
Probably because the overloaded PresentModeA is not generic so you can't use this syntax `PresentModeA[Foo]`, try with that: proc PresentModeA*[T: bool](d: T) = ...

Re: Perfecting Nim

2018-05-09 Thread mratsim
@aedt I think it's a question of resources. Given the current promising state it would be better to release now, garnering interest and goodwill and probably new hands to help on ironing bugs and use cases that the current tiny community doesn't need in my opinion. Also that allows those with

ref object or object with ref field

2017-04-10 Thread mratsim
Is there any performance/memory/anything else tradeoffs I should be aware of between those two type declarations? (note the place of the ref) type Context*[T] = object nodes: ref seq[Node[T]] And type Context*[T] = ref object nodes:

Re: Introducing myself

2018-01-14 Thread mratsim
Hey William, Nice to hear that you're using it heavily! Hopefully I don't break it too much at each releases. Edit: Oh, also consider adding yourself there: [https://github.com/nim-lang/Nim/wiki/Companies-using-Nim](https://github.com/nim-lang/Nim/wiki/Companies-using-Nim)

Re: Would love input / help with SIMD library proof of concept

2017-12-12 Thread mratsim
of asking "sse" or "avx", you should use compile-time define with `when defined(sse)` like I do [here](https://github.com/mratsim/Arraymancer/blob/master/src/tensor/backend/openmp.nim#L18) for openmp and cuda. And at compilation you can use `nim c -d:sse -o:out/yourproject your

Re: Tutorials and documentation for a nim project

2017-07-08 Thread mratsim
@euant no worries ! @Araq I had to update to the latest devel. It didn`t work with my nim install from the middle of May. I checked solutions that could be used to upload to Github Pages easily and was recommended [Couscous.io](http://couscous.io/). Workflow seems to be: * Have a directory

Re: Trying to write readable code, need help

2017-10-07 Thread mratsim
I agree, this:self makes code less grep-able. var vsl = self.vsl works because vsl is a ref type so the pointer is indeed copied but it points to the same (shared) data location.

Re: atomics: Why is interlockedCompareExchange8 "safe"?

2017-11-27 Thread mratsim
No, they are not, it would work only if seq[YourConcept] is not needed or only of homogeneous concrete type.

Re: possible compiler bug with generics?

2017-10-27 Thread mratsim
Can you post a minimum working example with all types declared. We can't reproduce your issue because: * BufferTarget is undeclared * BufferDataUsage is undeclared * glBufferData is undeclared * GLenum is undeclared * GLsizeiptr is undeclared Alternatively post an example with Nim

Re: Possible compiler bug?

2018-02-19 Thread mratsim
Yes, once Nim checked your code it should never crash in GCC/Clang. Compiler should also never crash during compilation (Red text with "Internal Error") You can report it in the Github issue.

Re: package like python's pandas?

2017-05-31 Thread mratsim
A bit off Nim topic, but in general for efficient pandas operations, you should never use for loops, and use provided pandas methods or the "apply / applymap" functions if you want to apply functions element-wise. "Groupby + transform" (aka Split-Apply-Combine) is really powerful as well for

Re: Do we have a RTree or R*Tree for Nim?

2017-11-27 Thread mratsim
As far as I know there is none. I'm interested in a pure Nim implementation of R-tree and closely related [Kd-tree](https://en.wikipedia.org/wiki/K-d_tree) for geospatial algorithms (clustering especially). I've added your suggestion to the "[Are we scientists

Re: Nim hashtable mapping strings to any type

2017-11-07 Thread mratsim
It seems like you want dynamic typing in a statically typed language. The proper way for heterogeneous collection of objects currently is: * with ref objects inheriting from the same base class. * with object variants In the future you will also be able to use concepts and VTables.

Re: OpenMP and Nim

2017-10-04 Thread mratsim
What kind of advanced usage do you need? You can always resort to the {.emit.} pragma to emit raw OpenMP pragma. Also [QEX](https://github.com/jcosborn/qex/blob/master/src/omp.nim) by jcosborn is probably the one using it the most as he even implemented barriers.

  1   2   3   4   5   6   7   8   9   10   >