Front page example

2019-09-30 Thread Nimster
This code on the front page as written returns the EVEN numbers from the function oddElements. Either i should be set to 0, or the passed array needs a 0 in the front in order to return ODD elements. # Thanks to Nim's 'iterator' and 'yield' constructs, # iterators are as easy to write as

Getting a strange error with file streams

2019-09-30 Thread dotheda
First off, not even sure if the code will really work once I fix this, but I'm sure I can figure out the rest; proc get_file_data(file: FileStream, offset: int, size: int): seq[char] = var test = newSeq[char]() file.setPosition() for i in offset ..

Re: Proposal to start a Nim-Scientific Community

2019-09-30 Thread minierolls
Would like to contribute here too! I am currently working on a (un)weighted FSA/FSM library (which can be easily used to implement HMMs), which might be useful for any NLP/Speech folks. Highly interested in keeping up with the progress in the community; is anyone working on a generic

Re: 1.0.0 is here

2019-09-30 Thread tedlavarias
That's what brought me here! Nim's announcement of going 1.0.0 showed up on my Google News feed so I took a look... And lo' and behold, this is exactly what I've always been hoping for! A language that combines the elegance of Python, with the safety of Pascal/Ada, and the power/speed of C! I

Re: Karax/Jester simple CRUD example?

2019-09-30 Thread juancarlospaco
I recommend you start learning Jester first, then you learn/add stuff on Frontend. Both projects have examples on their own repos, theres infinite possibilities on how to combine them. 

Re: How to tie procedure to type?

2019-09-30 Thread mratsim
I tried 4 different ways, 2 fails, 2 works. Using a proc as a generic (failure): type BinaryTree[V; compare: proc(a, b: V): bool] = object value: V proc insert[V; compare](tree: BinaryTree[V, compare], value: V): bool = # Error: attempting to call

Re: Proposal to start a Nim-Scientific Community

2019-09-30 Thread mratsim
I think we can replace iterator chaining by objects that represent the transformations. Then it can be applied lazily like Dask (aka build a compute graph) or applied like D-ranges, a bit like @timotheecour

Re: Hello, Nim!

2019-09-30 Thread mratsim
What you are missing is strformat: import strformat proc Print*()= for pe in elements: echo &" Time elapsed {pe.name} for {pe.t1-pe.t0} *" index = 0 elements.setLen(0) Run

Re: [RFC] Why use Nim?

2019-09-30 Thread rustomax
@sky_khan, thank you, this is educational. @Araq, nice list! There are some packages here I haven't come across of before, like gintro or fltk.

Re: [RFC] Why use Nim?

2019-09-30 Thread Araq
There is * [https://github.com/filcuc/nimqml](https://github.com/filcuc/nimqml) (Qt for Nim, not sure about its limitations) * [https://github.com/nim-lang/ui](https://github.com/nim-lang/ui) * [https://github.com/khchen/winim](https://github.com/khchen/winim) *

Hello, Nim!

2019-09-30 Thread Pixeye
First, gratz nim team on releasing v.1.0 I'm just sharing my...first impressions :) I'm a C# game developer that wants to learn something new and fresh, it's difficult to change mindset sometimes though. I decided to write something very stupid like time profiler "hello world" and I thought it

Re: [RFC] Why use Nim?

2019-09-30 Thread sky_khan
If you use only OS native widgets you'll have multiple-platform library, not cross-platform. You'll have to deal with every single detail for each widget on each OS you support. If a widget is not exists on one of your target OSes or behaves completely different, tough luck. Thats why Lazarus

Re: Karax/Jester simple CRUD example?

2019-09-30 Thread r3c
Thanks Huan, but I was looking for the most simpe CRUD example with Jester/Karax and all I found is this: [https://github.com/emekoi/joker](https://github.com/emekoi/joker) Which is useless, because its rendering static strings on the FE. Too bad, the frameworks are there, but there is lack of

Compile-time matrix sizes

2019-09-30 Thread japplegame
How to define matrix type with compile time sizes? C++ code: template struct Matrix { T data[M][N]; }; Matrix m; Run How to write something like this in Nim?

Re: Nim for Beginners Video Series

2019-09-30 Thread Kiloneie
#7 is live ! LINK: [https://youtu.be/Ystn3SG2yeU](https://youtu.be/Ystn3SG2yeU) Is the terminal now clearly visible from phones ? My phone is rather big so i am unsure.

Re: [RFC] Why use Nim?

2019-09-30 Thread rustomax
Neither. What I am looking for is an OS-native executable.

Re: [Maybe a new feature] Hook free function pointer.

2019-09-30 Thread rayman22201
We already have this in Nim. We have ptr in Nim. This is a raw C pointer. The GC does not track it. ref is a GC tracked pointer. you can use gc_ref and gc_unref to convert between the two freely:

Re: [RFC] Why use Nim?

2019-09-30 Thread vonH
Is this application a compile to exe with a web frontend, or a compile to Javascript with a web frontend?

Re: Proposal to start a Nim-Scientific Community

2019-09-30 Thread cdome
Hi, +1 to discuss scientific Nim in this forum until community is going to grow big enough. I am making a number of scientific calculations with Nim but from stochastic differential equations and Monte Carlo simulations for finance and insurance angle rather than neural networks and data

Re: Persistent data structures

2019-09-30 Thread ShalokShalom
So is there a popular translator from another language to Nim?

Re: Persistent data structures

2019-09-30 Thread dawkot
> Why do you think its easy? Well, it should be just a matter of translating whatever code is out there to nim.

Re: Persistent data structures

2019-09-30 Thread ShalokShalom
Yes, I think so. I am wondering that it is not yet implemented, if so. So far as I am informed are the different kinds of implementation different in terms of memory usage and so. Why do you think its easy?

Re: Karax/Jester simple CRUD example?

2019-09-30 Thread juancarlospaco
* Get data from Database to a Nim object type, `Row` usually. * Stringify Nim object type adding some HTML optionally, `$` usually. * Send over the string with Jester `resp "" & data & ""`. Basically is kinda like that. Having said that, if you want a more complete round solution you can

Re: Persistent data structures

2019-09-30 Thread r3c
You mean something like [immer.js](https://immerjs.github.io/immer/docs/introduction) ? I think not, but it would be very easy to create library like this

Persistent data structures

2019-09-30 Thread ShalokShalom
Persistent data structures are a fundamental idea of functional programming. With that, it is possible to create new instances of constants without altering them, which is obviously beneficial for multi-threaded programming. Is this

[Maybe a new feature] Hook free function pointer.

2019-09-30 Thread Lachu
Nim, as far as I known, uses GC, but can use C headers to generate bindings. C and C++ doesn't use GC, so there could be some weird situations, when C/C++ library free an memory and our program store pointer to this memory somewhere. Few years ago I had similar problem and solve it. I use free

Re: Great tutorials needed

2019-09-30 Thread ShalokShalom
[https://narimiran.github.io/nim-basics](https://narimiran.github.io/nim-basics)/ reads awesome ^-^

Re: Newbie experience with the documentation

2019-09-30 Thread ShalokShalom
Yeah, thats great. I suggest a beginners guide. What you think about it?

Re: Newbie experience with the documentation

2019-09-30 Thread Araq
Every document uses the same search and the search focusses on the APIs. Not ideal for your case but also no evil forces behind the curtain.

Re: Newbie experience with the documentation

2019-09-30 Thread ShalokShalom
The manual is not on top of the list of the documentation, as I said. Despite the fact the documentation about _type_ is quite sparse, I think it is important to provide the very fundamentals of the language on a prominent spot. Opposed to hidden within a wall of unrelated content, also the

Re: Proposal to start a Nim-Scientific Community

2019-09-30 Thread bobd
I'm working on stats/data science code (e.g. a Nim interface for R) and will open source everything when it's in a usable state (probably early next year). But in the meantime it would be useful to have somewhere to coordinate with other people working in this area - primarily to avoid

Example for using websocket with protobuf?

2019-09-30 Thread geohuz
I'm trying to use the protobuf with websocket, but I'm stuck on very simple case like send and receive message, my code is sth like below: const protoSpec = """ syntax = "proto3"; package DS; enum TOPIC { UNKNOWN = 0; PARSER = 1; CONNECTION = 2;

Re: Nim source size

2019-09-30 Thread federico3
The Debian (and therefore Ubuntu) package recommends gcc and build-essentials and uses only 31MB. There is also a nim-doc package that contains documentation. You can use it to build a Docker image with everything you need.

How to tie procedure to type?

2019-09-30 Thread japplegame
In D language we can tie function to a template by alias: struct BinaryTree(T, alias cmp_fun) { alias V = T alias compare = com_fun; } void main() { alias Tree = BinaryTree!(int, (a, b) => a < b); } Run It is no

Re: [RFC] Why use Nim?

2019-09-30 Thread rustomax
> Writing a good GUI framework that can do gpu accelerated rendering and call > to native APIs is a huge task I am out of my depth here, so please help me understand this better. Why do I need to worry about GPU acceleration to render a button or a checkbox in Nim? If a Nim wrapper library is

Karax/Jester simple CRUD example?

2019-09-30 Thread r3c
In other frameworks like Django, you can read from the DB into array/list, pass the array onto view and display it trough HTML Template. So you can do this without single line of JS code. Is it possible something similar with Jester? How do I pass the array from the BE to FE?

Re: Is it a bug?

2019-09-30 Thread Araq
@mratsim I gave it a try but the root problem is that C++ compilers do not support "named fields in const unions" (yet?), a C99 addition. So you can only initialize the first field of a union and nothing else.

Re: Proposal to start a Nim-Scientific Community

2019-09-30 Thread sschwarzer
I'm currently not using Nim for scientific computing, but I'm quite interested in what's going on in this area and follow related discussions in the forum.

Re: Is it a bug?

2019-09-30 Thread mratsim
Can't we do the other way around, start supporting case objects properly across compile-time to runtime boundary? That would be very useful for both [nimbus](https://github.com/status-im/nimbus/blob/78714295dab4ead5e56c0048c46ae07d8bbed91a/nimbus/vm/interpreter/gas_costs.nim#L360-L361), as a

Re: Cross compilation linux -> win + wine issue with file reading

2019-09-30 Thread sschwarzer
Have you tried reading the file and printing the start of its contents - at least up to and a bit beyond the first null byte as known from the hex editor - as hex strings to stdout? That way you could at least check if the problem already occurs when reading.

Re: Is it a bug?

2019-09-30 Thread Araq
Fair enough, consider it done.

Re: Is it a bug?

2019-09-30 Thread japplegame
Then why don't you start the deprecation process?

Re: Library for linear algebra

2019-09-30 Thread andrea
Hi Royi, as I have written in the README, [linear-algebra](https://github.com/unicredit/linear-algebra) is now discontinued in favor of its sequel [neo](https://github.com/unicredit/neo). But be sure to also check [ArrayMancer](https://github.com/mratsim/Arraymancer) which is much more

Re: [RFC] Why use Nim?

2019-09-30 Thread zulu
Writing a good GUI framework that can do gpu accelerated rendering and call to native APIs is a huge task that requires an entire business to be sustainable.