Re: Nim code to Remove Accented Letters

2016-10-03 Thread alfrednewman
@all, thanks a lot.

Re: Nim code to Remove Accented Letters

2016-10-03 Thread flyx
Here is how you can do it with premature optimization: import unicode, strutils proc translationTable(src, dest: string): array[0x1f00, char] {.compileTime.} = for i in 0..<0x1f00: result[i] = '\0' var srcIndex = 0 destIndex = 0 while srcInd

Re: Nim code to Remove Accented Letters

2016-10-03 Thread OderWat
As I said.. this and your original c-code will not work with UTF-8 at all. To make it work for UTF-8 you can use the [unicode.nim](http://forum.nim-lang.org///nim-lang.org/docs/unicode.html) module. But switching to UTF-8 and therefor Unicode will make all of that much more complex. For exampl

Re: Nim code to Remove Accented Letters

2016-10-03 Thread alfrednewman
OderWat, I guess there is something wrong with the UTF or so. I made the following test... proc translate(c: char): char = const a = "ÁÀÃÂÇáàãâçÉÊéêÍíÑÓÔÕñóôõÚÜúü" b = "CcEEeeIiNOOOnoooUUuu" let o = a.find(c) if o >= 0: return

Re: Nim code to Remove Accented Letters

2016-10-03 Thread OderWat
Well it could work like this: proc translate(c: char): char = const a = "abcdef" b = "123456" let o = a.find(c) if o >= 0: return b[o] else: return c proc main() = var s = "that is the abc" for c in s.

Re: Nim code to Remove Accented Letters

2016-10-03 Thread alfrednewman
Yeap, I know. What's the best way to implement your proc translate ? Say I have an input string like "Cédille Français". How can I use the proc with it ? Sorry my basic questions, but I am a pretty new with Nim... Cheers

Re: Version 0.15 released!

2016-10-03 Thread dom96
You guys might want to double check that. The docs.zip file was missing from the server so it's likely it only started working for you after it was uploaded, not due to a change in install path or the addition of admin privileges. But I guess that's possible too :)

Re: Nim Chess 2 with transposition table support is available

2016-10-03 Thread Stefan_Salewski
Thank you all for testing. I have just fixed position values for knight vs bishop, so total value of these two is really equal in average. And I scaled the total position values, so computer may in very rare cases give away a pawn for a very good position. @dom So what is your advice concernin

Re: Nim Chess 2 with transposition table support is available

2016-10-03 Thread flyx
Your compilation instructions would probably be nicer if, instead of depending on absolute paths and symlinks, there would be a Makefile like this: board: board.nim engine.nim nim c -p:../nim-gio/src -p:../nim-atk/src -p:../nim-glib/src -p:../nim-gdk3/src -p:../nim-gtk3/src

Re: Nim code to Remove Accented Letters

2016-10-03 Thread OderWat
I think one could import memchr() to nim and do the same as in the C version. Besides that there is the naive implementation: proc translate(c: char): char = const a = "abc" b = "123" let o = a.find(c) if o >= 0: return b[o] else

Re: Nim Chess 2 with transposition table support is available

2016-10-03 Thread dom96
Good job, but why are you inlining _every_ **single** procedure?