How do genericHead and stripGenericParams actually work?

2017-12-27 Thread Udiknedormin
I followed the manual as for how to use higher-kinded concepts. I was quite surprised when the code containing genericHead actually compiled, but returned something I don't really get... import future, typetraits, options type Functor[A] = concept f f.get is A

Re: What's the purpose of CountTable?

2017-12-27 Thread Udiknedormin
No, you're wrong. Iterable is ANY container that can be iterated over (including lists, sets etc) while openArray is anything that has an array-like memory layout, i.e. array or seq. Your code fails for containers which with non-linear memory layout: import lists var li =

Re: Can I somehow emulate Java's System.currentTimeMillis() in Nim?

2017-12-27 Thread GULPF
I've now opened a PR for this ([https://github.com/nim-lang/Nim/pull/6978](https://github.com/nim-lang/Nim/pull/6978) ). Feel free to comment on it if there is any concern.

Re: Nim on Ubuntu - only old version?

2017-12-27 Thread dom96
Ubuntu isn't a rolling distro so all of its packages are usually behind. This is more prominent for some packages like Nim because we release relatively often and each new release has many new features. There are many ways to get around this. Ubuntu has a concept of PPAs, but I'm not aware of o

Re: How could we make code readability better on third-party plateforms? (Github/Gitlab/Bitbucket/etc.)

2017-12-27 Thread henric
# I could also recommend you take a look at the research [GitHub vs BitBucket vs GitLab](https://www.cleveroad.com/blog/github-vs-bitbucket-vs-gitlab-developers-research) What do you think about it?

Re: owerflowChecks - how to make it work

2017-12-27 Thread geo555
Ah, I've found where the bug is. If it's written there as r = r * x, it's compiled into r = (NI)(r * x); and it's ok. But if it's written as r *= x, it's compiled into stareq__blah-blah((&r), x); which obviously ignores that pragma. So it must have been like r *= x; in C code instead of stareq

Re: Nim on Ubuntu - only old version?

2017-12-27 Thread geo555
And I uninstalled the 0.12 and built the 0.17.2 from the sources. It went well and as described, so many kudos to that (although it gets a bit strange in directory c_code, but ok, it works in the end). But that's not what I asked, sorry. The question was if apt-get install nim was going to insta

Re: owerflowChecks - how to make it work

2017-12-27 Thread geo555
Yeah, the manual is absolutely helpless here. Now the question stays -- how to make these checks off in the example above.

Re: What's the purpose of CountTable?

2017-12-27 Thread moigagoo
PR submitted: [https://github.com/nim-lang/Nim/pull/6977](https://github.com/nim-lang/Nim/pull/6977)

Re: Nim on Ubuntu - only old version?

2017-12-27 Thread opqx
I use choosenim for all platforms. [https://github.com/dom96/choosenim](https://github.com/dom96/choosenim)

Re: What's the purpose of CountTable?

2017-12-27 Thread moigagoo
> I can't see any proc to create a CountTable from any iterable so I think > you're wrong with assigning ones [toCountTable](https://nim-lang.org/docs/tables.html#toCountTable,openArray\[A\]) does that. > Also, it's not just like any table, as it provides inc proc Well, yes, but you actually h

Re: owerflowChecks - how to make it work

2017-12-27 Thread Varriount
>From the [compiler >manual](https://nim-lang.org/docs/nimc.html#compiler-usage-command-line-switches): \--overflowChecks:on|off \- turn int over-/underflow checks on|off

owerflowChecks - how to make it work

2017-12-27 Thread geo555
When I run this program in a usual way (nim c -r), it stops with overflow error. How can I switch this check inside? I tried what I could find in doc/sources, but it does not seem to work. {.push overflowChecks: off.} proc `^`(x,y:int):int = (var r=1;for i in 1..y:r*=x;r)

Nim on Ubuntu - only old version?

2017-12-27 Thread geo555
On Ubuntu, I ran $ sudo apt-get install nim and it installed nim ok, but it's version 0.12.0 (2015-11-02) [Linux: i386]. Isn't it a bit old? Anybody plans to upgrade it? I mean automatic no-brain installation with apt-get install nim, w/o downloading the sources and compiling them myself. Tha