Re: GTK 3.20 Nim wrapper

2016-11-12 Thread vlad1777d
But do you know what to do with this error? 
[https://pp.vk.me/c638518/v638518447/8b77/4XL_Mn8aakE.jpg](https://pp.vk.me/c638518/v638518447/8b77/4XL_Mn8aakE.jpg)


Re: Fun with deduplicate

2016-11-12 Thread Krux02
yes of course sorting is slow, when comparison is slow, but most of the time 
comparison is not too complicated. For the following use case, there is a way 
to reduce the calculation costs. (warnig all non tested pseudocode, not even 
checket if I use sort correctly)


var someData: seq[A] = ...
proc cmp(lhs,rhs:A): int = cmp(someComplexCalculation(lhs), 
someComplexCalculation(rhs))
result = someData.sort(cmp)


to something like this:


var someData: seq[A] = ...
var tmp = newSeq[tuple[index:int, value: B]](someData.len)

for i,val in someData:
  tmp[i] = someComplexCalculation(val)

proc cmp(lhs,rhs : tuple[index:int, value: B]): int = cmp(lhs.value, 
rhs.value)
tmp.sortInplace(cmp)
for i,val in tmp:
  result[i] = someData[val.index]


now the someComplexCalculation is only used _N_ times, instead of _N log N_


Re: Promoting Nim via Exercism

2016-11-12 Thread hcorion
Wow! Very cool! The name is quite off-putting, but it's great to see Nim 
available in one of the code practicing websites. I've been wanting to add Nim 
to CodeWars, reference issue here: 
[https://github.com/Codewars/codewars-runner-cli/issues/177](https://github.com/Codewars/codewars-runner-cli/issues/177)
 but I don't really feel like learning docker and fumbling around with bash 
scripts.


Promoting Nim via Exercism

2016-11-12 Thread clementi
Hey everyone,

Want a great way to promote Nim? There's a 
[track](http://forum.nim-lang.org///exercism.io/languages/nim/exercises) on 
[Exercism](http://forum.nim-lang.org///exercism.io) for coding exercises in 
Nim. The track has only 13 problems in it right now, but [there are over a 
hundred](http://forum.nim-lang.org///exercism.io/languages/fsharp/exercises) 
that are possible. Anyone can [implement existing exercises or contribute new 
exercises](http://forum.nim-lang.org///exercism.io/contribute) via 
[GitHub](https://github.com/exercism).