Re: Extract a substring

2020-06-18 Thread warrensacko
Try with.. [Python Substring](http://net-informations.com/python/basics/substring.htm)

Re: Comparisons of Nim to the Chapel computer programming language...

2020-06-18 Thread Brad
Hi @mratsim — I may have been unclear in my last response: I didn't mean to imply that I didn't believe there are realistic workloads that would result in recursive tasks or benefit from task serialization/squashing/stealing techniques. Just that the computations and users that have found their

Re: Unclear (for Python people) import behavior. And how to deal with it

2020-06-18 Thread ZadaZorg
@juancarlospaco thanks, I read links you provide before. Maybe I'm skipped, but there were no explanations of such catch. @Yardanico oh, thanks a lot. I think that is it!

Has anyone wrapped zlib or reimplemented deflate?

2020-06-18 Thread snej
To implement the network protocol I'm working on, I need to compress/decompress data using the [deflate](https://en.wikipedia.org/wiki/DEFLATE) algorithm. The existing C++ protocol implementation uses zlib for this. I don't see any zlib wrappers or reimplementations in nimble, but thought I'd a

Re: Unclear (for Python people) import behavior. And how to deal with it

2020-06-18 Thread juancarlospaco
* [imports](https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#Imports) * [Objects](https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#Objects) * [I recommend read it completely](https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#table-of-contents)

Re: Unclear (for Python people) import behavior. And how to deal with it

2020-06-18 Thread Yardanico
Your example can be fixed by doing export ex.uuid Run Or, if you want to export _everything_ from that module (export only exports things which are marked by `*`: import ex export ex Run See [https://nim-lang.org/docs/manual.html#mod

Re: Has anyone wrapped zlib or reimplemented deflate?

2020-06-18 Thread Yardanico
Check out [https://github.com/nim-lang/zip](https://github.com/nim-lang/zip)

Unclear (for Python people) import behavior. And how to deal with it

2020-06-18 Thread ZadaZorg
During my learning of nim, I'm trying to implement some kind of code common for Python OOP. I'm spent a lot of time reading articles, book, forum and feels like I'm more or less OK with basics. But today I meet strange bug (as I initially think), which is explained in 3 listings below... File

Re: Visual Studio Code plugin

2020-06-18 Thread lscrd
Yes, you are right. But as Nim syntax doesn’t change a lot, this is understandable. Nevertheless, there are several issues which should have been solved (easier said than done of course). The alternative plugin seems currently more active. So, this may be a better choice in the future. But I th

Re: Visual Studio Code plugin

2020-06-18 Thread ZadaZorg
I just choose to use Nim-alt, and did not meet with any problems. Everything I expect is work, but I'm not a very powerful user of Nim yet.

Re: Parallel coding in Nim (as compared to OpenMP/MPI)

2020-06-18 Thread hugogranstrom
I can try to answer 5), that's really the only one I'm qualified to answer XD I'm also learning Weave now and it's a really nice experience and your other questions intrigues me as well. The difference between addr and unsafeAddr is that addr only works on mutable things like var output for exa

Re: Nim version 1.2.2 is out!

2020-06-18 Thread LeFF
That's great, thank you!

Re: Nim version 1.2.2 is out!

2020-06-18 Thread snej
I just filed [https://github.com/nim-lang/Nim/issues/14719](https://github.com/nim-lang/Nim/issues/14719) to request this.

Re: Perf: Table.del(key)is taking 85% of my code's time

2020-06-18 Thread Yardanico
By "main config" I mean [https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg](https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg)

Re: Perf: Table.del(key)is taking 85% of my code's time

2020-06-18 Thread Yardanico
That's not a nimble bug - see [https://github.com/nim-lang/Nim/issues/14272](https://github.com/nim-lang/Nim/issues/14272)

Re: Parallel coding in Nim (as compared to OpenMP/MPI)

2020-06-18 Thread jasonfi
A link to an article I wrote: [https://onlinetechinfo.com/concurrency-and-parallelism-in-nim](https://onlinetechinfo.com/concurrency-and-parallelism-in-nim) (with lots of links).

Re: Comparisons of Nim to the Chapel computer programming language...

2020-06-18 Thread mratsim
> For example, a favorite toy Chapel program creates a fixed number of tasks > that compute a producer-consumer pattern on a bounded buffer of > synchronization variables with full/empty semantics. In my experience, this > is a challenging pattern to express in many task-based systems due to the

Re: Perf: Table.del(key)is taking 85% of my code's time

2020-06-18 Thread snej
> Are you putting -d:release in the config file by any chance? If you do - that > wouldn't work, you must specify it in the call to the compiler/nimble build That's it! I put it in `nim.cfg` like all the other compile options. If instead I run `nimble build -d:release`, I get an optimized build.

Re: Parallel coding in Nim (as compared to OpenMP/MPI)

2020-06-18 Thread Rooibos
Thanks very much for detailed info and various links! I did not even know that OpenMP is supported via `||` (though with some restriction), so I will play around with it and also learn Weave (which seems more flexible and efficient). And, I have several more questions... 1) Based on the above i

Re: Perf: Table.del(key)is taking 85% of my code's time

2020-06-18 Thread Stefan_Salewski
> key distribution matters a lot That is true, but it is obviously not the problem for Mr snej. He gets good performance when he disables all checks one by one, but not with -d:danger. So his configuration is somewhat broken. And note, -d:danger is enough, no need for -d:danger -d:release. We s

Re: Hi all, pass Nim functions to C code as callbacks?

2020-06-18 Thread Stefan_Salewski
That is done in libs like gtk a lot. The Nim procs needs the cdecl pragma for this to work.

Re: Perf: Table.del(key)is taking 85% of my code's time

2020-06-18 Thread coffeepot
Just wanted to add to what @treeform mentioned, key distribution matters a lot when deleting with tables. Check out the timings of sequential keys vs a more distributed table access. import tables, times, random, sugar template bench(code: untyped) = let t1 = cpuTime(

Re: Perf: Table.del(key)is taking 85% of my code's time

2020-06-18 Thread Yardanico
Are you putting -d:release in the config file by any chance? If you do - that wouldn't work, you must specify it in the call to the compiler/nimble build

Re: Is --gc:arc completely independent from the older ownership model?

2020-06-18 Thread didlybom
Thank you @Araq, that is pretty clear. This matched what I would expect from a “deterministic” memory management model. I don’t take that to mean I know _[exactly](https://forum.nim-lang.org/postActivity.xml#exactly) when me left is freed but that you can reason about it (as opposed to a garbage

Re: Is --gc:arc completely independent from the older ownership model?

2020-06-18 Thread Araq
I think you should watch my talk at NimConf.

Hi all, pass Nim functions to C code as callbacks?

2020-06-18 Thread hyvuminhtuan
Hello forum im a new, nice to meet u all. I've looked around and I can't answer this. I want to be able to pass a Nim function / proc to C as a function pointer and get C to call it. I don't have a specific reason I want to do this, but I might need it soon. Many tks

jester: one handler for several routes?

2020-06-18 Thread luntik2012
I'd like to write something like C's switch/case. Is it possible without writing a custom router? routes: get "/hello": get "/helloWorld": resp "Hello World" Run I can write separate handler proc and return http code, headers and content, but

Re: Visual Studio Code plugin

2020-06-18 Thread didlybom
Thanks Iscrd. I am not saying that the old plugin is abandoned but it certainly seems to be updated much more slowly than nim itself.

Re: When will the NimConf timeline get posted?

2020-06-18 Thread Araq
We're scheduling the talks today and will contact the speakers and update the website afterwards. Sorry for the delay but just today we received 3 more talks.

Re: When will the NimConf timeline get posted?

2020-06-18 Thread digitalcraftsman
There's a dedicated page for NimConf ([https://conf.nim-lang.org)](https://conf.nim-lang.org\)), so I guessing it will be posted there at some point of time.

Re: Visual Studio Code plugin

2020-06-18 Thread lscrd
Personally, I use the original plugin as I was not aware that an alternative one exists. This plugin seems in fact quite recent (first commit by Gary M on 20 April) and, logically, there is some activity on it. Besides, we can’t say that the original plugin is abandoned as the last commit was o

Re: When will the NimConf timeline get posted?

2020-06-18 Thread sschwarzer
Hm, it's clearly after Tuesday now and the conference is only two days away. It would be really nice to get a timetable of the talks. :-)

Re: Is --gc:arc completely independent from the older ownership model?

2020-06-18 Thread Araq
Well I can only describe how arc works and I can assure you that Rust/Lobster work very similarly and none of these languages have "compile-time reference counting", strictly speaking. Nim's integers, floats, enums, bools and objects of these and arrays of these _always_ are "value" based types

Visual Studio Code plugin

2020-06-18 Thread didlybom
I see that there are 2 Visual Studio Code extensions for nim. The one that has the most downloads by far is vscode-Nin ([https://github.com/pragmagic/vscode-nim)](https://github.com/pragmagic/vscode-nim\)). That one is not updated very frequently. I don’t think it even claims to support nim 1.0

Re: Is --gc:arc completely independent from the older ownership model?

2020-06-18 Thread didlybom
I have not followed the arc story too closely but I have a few questions about it. In particular I’d like to understand how it compares to the C++ memory model. I skimmed the Lobster memory model document referenced by @Araq. In it they talk about “in-line, by-value structs”. Is this model used