Re: Where can I deploy a Nim web application? Is there a "NimAnywhere" yet?

2020-04-11 Thread tedlavarias
Wow! Thanks for the detailed response! I'll definitely look into it! I thought Digital Ocean wouldn't have been an option with Nim, but Docker seems to make it possible... That seems to be a pattern I've been noticing when trying to research this topic in particular...

Re: A pure Nim k-d tree

2020-04-11 Thread spip
As a Canadian too, I didn't push for the 'or' change... and I'm pleased with the English 'our' wording.

Re: A pure Nim k-d tree

2020-04-11 Thread jlindsay
Well that was embarrassing. I've fixed the 'I' 'e' spelling throughout and committed the changes. Thank you for noticing that. As a Canadian, I can't approve the 'or' over 'our' spelling however! All the English speakers in the UK, Canada, Australia, New Zealand, South Africa, etc. wouldn't be

Re: Where can I deploy a Nim web application? Is there a "NimAnywhere" yet?

2020-04-11 Thread JohnAD
Myself, I use Digital Ocean for hosting, using docker-compose. I keep the source code (w/o credentials) for each site on separate private repos and put the results on a separate repo for the docker instance. Essentially, each website is compiled with C. I write a move.sh bash script to move

Re: A pure Nim k-d tree

2020-04-11 Thread spip
There are small typos in proc names (revert **i** and **e** ): nearestNieghbour should be written nearestNeighbour, and similar for nearestNieghbours. Or if you prefer the American wording, nearestNeighbor... Better to correct that now than when it is broadly used. Have been referenced in [Nim

Re: Format() problem with Jester

2020-04-11 Thread JohnAD
I recognize this code. :) If you would like the original, I've been placing the website code after each section of the YouTube series at: [https://github.com/JohnAD/bookclub](https://github.com/JohnAD/bookclub) If you look at the releases, each release points to the commit for that part of the

Re: Nim programming book for kids

2020-04-11 Thread cantanima
> We have discussed that term really long enough. Is your beginner someone with > absolutely no CS skills or someone having programmed in C++ and Haskell for > 15 years and is now comming to Nim? I'm talking about reading level. At home I have a 12 year old and a 13 year old. The book would

Re: table of openarray as value

2020-04-11 Thread SolitudeSF
openarray is not a concrete type, you can use it only in procedure declarations. you need to use array or a sequence.

Re: Platform dependent newline

2020-04-11 Thread Araq
Yeah `\p` is the platform specific newline but in most cases `\n` works better since indeed Windows accepts LF everywhere with the exception of some 3rd party applications.

Re: A pure Nim k-d tree

2020-04-11 Thread jlindsay
@b3liever Thanks for the catches. I've just pushed the changes now.

Re: A pure Nim k-d tree

2020-04-11 Thread b3liever
Great library Thanks! `HyperRectangle` doesn't have to be a `ref object` since it only contains two `KdPoint` s and doesn't get copied.

Re: A pure Nim k-d tree

2020-04-11 Thread Stefan_Salewski
When its works in editors like VScode or neovim fine then all is ok, and I think it will as it is not that much generic. My RTree is very generic, and nimsuggest has big problems with it. I was told that neovim is not really blocked, as it uses async LSP, but of course all is delayed much.

Re: A pure Nim k-d tree

2020-04-11 Thread jlindsay
It seems to work within VS Code for me, with autocomplete working as expected. That said, I'm not sure if it would work with others. The only generic parameter in it is with the data associated with points.

Re: A pure Nim k-d tree

2020-04-11 Thread jlindsay
I'm not sure if it works with nimsuggest. I'm still just experimenting with Nim and am not all that knowledgable of it's larger ecosystem. Is there a way that I can check if it works with nimsuggest? I've seen your RTree implementation and it's quite impressive!

Re: A pure Nim k-d tree

2020-04-11 Thread Stefan_Salewski
Nice, does it work with nimsuggest and Nim editors? My RTree unfortunately blocks nimsuggest for 30 seconds permanently, which makes using it a bit hard. Maybe next winter I will compare your tree against my one.

Platform dependent newline

2020-04-11 Thread Stefan_Salewski
I think 4 or five years ago there was "n" as general newline char that could be two chars for windows and mac? Now there seems to be "p" for that purpose? I missed the detailed discussion. So would we now use "p" generally for terminal output. And "n" only when we want to guaranty that our

A pure Nim k-d tree

2020-04-11 Thread jlindsay
I have created a pure Nim k-d tree implementation ([https://github.com/jblindsay/kdtree)](https://github.com/jblindsay/kdtree\)). It's rather flexible compared with many existing k-d tree libraries, allowing for single and multiple nearest neighbour searches, within-radius (circular search

Re: Return complex type from thread

2020-04-11 Thread readysloth
But type i serialized wasn't reference type... I did serialization via marshal module, so program struggles to find int in the beginning of the json (i guess this is memory address)

Re: FFI - ipopt solver - malloc(): corrupted top size

2020-04-11 Thread mantielero
Thanks a Araq for trying. I manage to find and solve the problem. Regarding the cast, are you referring to [these](https://github.com/mantielero/ipopt.nim/blob/master/src/ex01.nim#L238-L244). I need to think about how to make it easier using the library.

Re: Return complex type from thread

2020-04-11 Thread dawkot
You didn't change .to[:T] to .tp[:ref T]

table of openarray as value

2020-04-11 Thread pitr
When creating a table where values are arrays: import tables var env = newTable[string, openarray[int]]() Run I get the following error: main.nim(2, 19) template/generic instantiation of `newTable` from here

Re: Return complex type from thread

2020-04-11 Thread readysloth
I guess i doing something wrong, because i tried it like this: proc deserialize[T](filename: string): ref T = read_file(filename).to[:T] let obj = spawn deserialize[A]("my_file.json") Run And it says: Error: type mismatch: got but

Re: FFI - ipopt solver - malloc(): corrupted top size

2020-04-11 Thread Araq
I skimmed your wrapper code and your example code and unfortunately couldn't find a bug. However your `cast`'s can be avoided if you start out with the `ptr UncheckedArray` types.

Re: Compiling problem

2020-04-11 Thread Araq
Fwiw this "quirk" was well known when we designed the syntax. For me it's a feature, either write `x + y` or `x+y`; `x +y` is ugly and inconsistent.

Re: Where can I deploy a Nim web application? Is there a "NimAnywhere" yet?

2020-04-11 Thread tedlavarias
Found this in the "Curated Packages" list for Nim: [https://github.com/planety/prologue](https://github.com/planety/prologue) Has anybody here used Prologue? How does it compare to Jester?

Re: Strange "type mismatch" error

2020-04-11 Thread Araq
Use more `import` instead of `include`.

Re: Return complex type from thread

2020-04-11 Thread Araq
Make your complex object a `ref object`.

Return complex type from thread

2020-04-11 Thread readysloth
Hi all! I have function, that does deserialization in a way, that it takes filename and type and returns complete object. It takes too long to process sequentially couple of files, so i wanted to parallel calls, because they are not data-tied. However, I cannot simply spawn ` thread from

Re: Strange "type mismatch" error

2020-04-11 Thread Hlaaftana
We're not going to catch what you're missing if you don't post more code.

[solved] how do I set current directory with os.setCurrentDir(newDir: string) ?

2020-04-11 Thread refaqtor
Don't ya just hate it!? when you bang your head on a problem only to find the answer in a post to YOUR OWN FOUR YEAR OLD [solved] QUESTION !!! Thanks again, forum, for being here. Write good comments-- the coder you help may be yourself!

Strange "type mismatch" error

2020-04-11 Thread mantielero
I am getting the following error: /home/jose/src/VapourSynth.nim/test/ex12.nim(24, 6) Error: type mismatch: got but expected one of: proc append(vsmap: ptr VSMap; key: string; data: float) first type mismatch at position: 3 required type for data: float but

Re: Compiling problem

2020-04-11 Thread Hlaaftana
This is so you can do things like echo -3 Run which parses as `echo(-3)` instead of `echo - 3`. Same goes for echo [1, 2, 3] echo @[1, 2, 3] # parsed as echo([1, 2, 3]) echo(@[1, 2, 3]) # iinstead of echo[1, 2, 3] echo @ [1,

Re: FFI - ipopt solver - malloc(): corrupted top size

2020-04-11 Thread mantielero
Just for the record, it was much more informative (at least for me) compiling with: $ nim c --profiler:on --stacktrace:on ex01 and then checking the error messages provided by valgrind: $ valgrind ./ex01

FFI - ipopt solver - malloc(): corrupted top size

2020-04-11 Thread mantielero
I have started wrapping [Ipopt](https://github.com/coin-or/Ipopt), a numerical optimizer. As always, the beginnings are hard. I wrapped it with c2nim. Now I am getting a memory error that I have reported [here](https://github.com/coin-or/Ipopt/issues/371). I have put my code

Re: OOP question

2020-04-11 Thread tanguymario
Thank you very much!

Re: OOP question

2020-04-11 Thread mratsim
Also note that traditional OOP languages do not have multiple dispatch so what you are trying would not be possible in C++ or Java.

Re: Format() problem with Jester

2020-04-11 Thread nelsonqt
That makes sense. Thanks.