How to use ropes module efficiently?

2017-10-08 Thread yuutayamada
I tried to compare string concatenation using ropes and system's add, but seems 
the bench mark result is not right... Does anyone know how to use this module 
efficiently? (Also, I must admit that I never used rope algorithm, so I might 
doing wrong)

rope_test.nim 


import times, ropes

proc strBench(sample: Rope|string) =
  var str = when sample is Rope: rope("") else: ""
  
  let startTime = getTime()
  defer:
let endTime = getTime()
echo endTime.toSeconds() - startTime.toSeconds()
  
  for i in 0 .. 6_000_000:
str.add sample


const sample = "something\n"
strBench(sample.rope())
strBench(sample)

# nim c -r rope_test.nim
#   rope version -> 3 sec
#   normal version -> 1 sec




Re: Version 0.15 released!

2016-10-01 Thread yuutayamada
> the old ways still apply though nimsuggest ...

Okay. Thanks Araq.


Re: Version 0.15 released!

2016-10-01 Thread yuutayamada
Congrats new release!

I have a little question about the download page. Is the nim e 
install_tools.nims official recommended way to use nimsuggest from now? (No 
more supported nimble install nimsuggest?)


Re: Results of our community survey

2016-09-10 Thread yuutayamada
+1 for nimsuggest's improvement and actually I puzzled people complain about 
lack of IDE support because there are already many editors or IDEs support for 
Nim: 
[https://github.com/nim-lang/Nim/wiki/editor-support](https://github.com/nim-lang/Nim/wiki/editor-support)

Back to nim survey, I wondered the opinion about "prefer functional paradigm" 
that no nim users answered. should we ask more dedicated questions about fp if 
we have second survey? since nim already support some functional programming 
futures. (i.e, ->, =>, lc[] macro of future package, apply procedure, or 
vegansk's nimfp library, or noSideEffect pragma) or maybe just lack of 
advertisement? (I'm not so sure about functional programming, so please correct 
me if I'm wrong)


Re: How to use --define:SYMBOL:VAL option?

2016-07-22 Thread yuutayamada
Thank you Araq! This option seems pretty handy.


How to use --define:SYMBOL:VAL option?

2016-07-22 Thread yuutayamada
I compiled following content with: nim c -r --define:line:10 foo.nim but I got: 
foo.nim(2.9) Error: undeclared identifier: 'line'

How can I access the line variable? or Am I doing something wrong?


when defined(line):
  echo line


Thanks