How to initialise a seq in an object

2021-02-22 Thread halloleo
This is probably super-stupid, but I cannot get to work an object which contains a sequence of another object: ColInfo* = object in: string out: string TableInfo* = object cols*: seq[ColInfo] Run I can create `var ti = TableInfo()

Can't give testament compiler switches when running a pattern

2021-02-22 Thread shirleyquirk
it's documented [here](https://nim-lang.org/docs/nims.html) but you're right that should be mentioned under configuration files too

Can't give testament compiler switches when running a pattern

2021-02-22 Thread halloleo
Makes sense. But who is reading the `config.nims` file? Looking at [Configuration Files](https://nim-lang.org/docs/nimc.html#compiler-usage-configuration-files) in the Nim User Guide I only find config files like `nim.cfg` and `myfile.nim.cfg`. Is it something testament specific?

Check out my new lib Spacy: Spatial data structures for Nim.

2021-02-22 Thread treeform
@Stefan_Salewski your Delaunay Triangulation is really cool!

Building nimx and rod on MacOSX (get error, but not using linux)

2021-02-22 Thread ynfle
Works for me

Building nimx and rod on MacOSX (get error, but not using linux)

2021-02-22 Thread reversem3
Trying to use rod on MacOSX but I get mismatch errors. nake build [15:57:48] Hint: used config file '/Users/.choosenim/toolchains/nim-1.4.2/config/nim.cfg' [Conf] Hint: used config file '/Users/.choosenim/toolchains/nim-1.4.2/config/config.nims' [Conf] ...

How to implement universal `collection.pick(field_or_fn)`?

2021-02-22 Thread shirleyquirk
Or you could use `list.mapIt(it.field)`

Can't give testament compiler switches when running a pattern

2021-02-22 Thread Araq
You raise good points and we'll improve testament further.

How to implement universal `collection.pick(field_or_fn)`?

2021-02-22 Thread alexeypetrushin
> Your last usage of pick is basically the same as a call to map I didn't knew map can do that :). Although it has its own limitation, it works with `function` but not with `field`. I found a way, by using sugar macro import sugar, sequtils template pick*[T](list: seq[T],

How to implement universal `collection.pick(field_or_fn)`?

2021-02-22 Thread PMunch
Your last usage of `pick` is basically the same as a call to `map`. There are a couple of ways to achieve this, the easiest but slightly hacky way is to do this ([playground](https://play.nim-lang.org/#ix=2QlR): #import sequtils template pick*[T](list: seq[T], field: untype

How to implement universal `collection.pick(field_or_fn)`?

2021-02-22 Thread Yardanico
Maybe not the cleanest, but you can do this: template pick*[T](list: seq[T], field: untyped): untyped = var res: seq[typeof(list[0].field)] = @[] for v in `list`: res.add v.`field` res let people = @[(name: "John"), (name: "Sarah")] echo people.

How to implement universal `collection.pick(field_or_fn)`?

2021-02-22 Thread alexeypetrushin
I would like to implement `pick` function that would extract the given `key` from the collection objects. let people = @[(name: "John"), (name: "Sarah")] echo people.pick(name) Run It works if the key is the **object field** , but doesn't work if it's a **function

Check out my new lib Spacy: Spatial data structures for Nim.

2021-02-22 Thread enthus1ast
So much cool stuff, if I just had more time (or less other stuff todo).

Check out my new lib Spacy: Spatial data structures for Nim.

2021-02-22 Thread Stefan_Salewski
Yes, would be nice. My CDT is a very advanced lib, it provides a fully dynamic incremental delaunay triangulation based on the quad edge data structure. I used CGAL with Ruby for that ten years ago for that, as I was not able to code it myself, and of course Ruby is too slow for it. Then two yea

Check out my new lib Spacy: Spatial data structures for Nim.

2021-02-22 Thread Clonk
No I haven't. I'l ltake a look at it. For now, I'm using `scipy.Delaunay` through Nimpy and was looking into creating binding for the C++ underlying library Qhull used by Scipy, but a pure Nim solution is always nicer to work with.