Re: Future of Nim ?

2019-05-29 Thread GordonBGood
> What I said above ("Nim is almost never the best choice for any field...") > unfortunately(?) also has an analog in "Nim is not the [superlative]". Nim > probably will never reach 100% of C's speed, Yes, Nim isn't perfect, but I don't find that execution speed is one of its problems. As it ca

Re: Struggling with writing an iterator

2019-05-29 Thread jlhouchin
I have read that before. I don't quite understand all of it in relation to how to write an iterator and call it. However, I went and put back the {.closure.} in my iterator and it works if I call like this: var stream = pricestream for p in stream("oanda", EUR_USD): ...

Re: Struggling with writing an iterator

2019-05-29 Thread jyapayne
Looks like you just need a first class iterator. [https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-first-class-iterators](https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-first-class-iterators)

Struggling with writing an iterator

2019-05-29 Thread jlhouchin
I am writing an iterator which calls walkDir and iterates over all of the files in the dir creating objects from those files. I have a proc which reads the file and creates a seq of the objects. It works fine. Amazingly so, on my machine Nim will read one of these files and create almost 400k ob

Re: Trouble when splitting in a CLI application

2019-05-29 Thread mashingan
parseopt of course can extract the argument too import parseopt let cmdline = "config create \"a configuration\"" var opt = initOptParser(cmdline) for kind, key, val in opt.getOpt(): case kind of cmdArgument: echo "argument: ", key else:

Re: Trouble when splitting in a CLI application

2019-05-29 Thread milerius
Perfect <3

Re: Trouble when splitting in a CLI application

2019-05-29 Thread miran
> There is a way using strutils or regex package to split on whitespace but > ignoring space in quoted arguments ? You could use: [https://nim-lang.github.io/Nim/parseopt.html](https://nim-lang.github.io/Nim/parseopt.html)

Re: Trouble when splitting in a CLI application

2019-05-29 Thread milerius
I dont think it's solve my problem, it's not option with `--my_opt=value` it's more like `cmd args`

Re: Trouble when splitting in a CLI application

2019-05-29 Thread shashlick
Use parseCmdLine()

Re: Nim Advocacy & Promotion Strategies

2019-05-29 Thread gemath
My bad trying to be sarcastic on the internet. > I don't know what you mean by "wrench code from the hands of open-source > software projects who dare to use proprietary software". You may have noticed that I copied the language from your illustrative non-source and made some replacements: pro

Default path for loading function from dynamic library

2019-05-29 Thread milerius
Hello given the following function: proc createConfig*(configName: cstring; returnedConfig: ptr ptr Config): ReturnedValue {. cdecl, importc: "createConfig", dynlib: "libalbinos.so".} Run libalbinos.so is installed in /usr/local/lib/libalbinos.so which is

Trouble when splitting in a CLI application

2019-05-29 Thread milerius
Hello I am doing a CLI (shell-like) application and I have a problem when I split my arguments milerius@inspiron:~/Documents/EIP/albinos/albinos-editor$ LD_LIBRARY_PATH=. ./albinos_editor --cli Usage: help (show this message) exit (quitting the

nim-terminaltables

2019-05-29 Thread aredirect
[terminaltables](https://github.com/xmonader/nim-terminaltables) is used to generate terminal tables (ascii or unicode ones) with customizable styles there're some examples in the repo ^_^ Please feel free to open issues or contribute in any suitable way, maybe even better choice for the charac

Re: xmldomparser on frontend - compile to javascript

2019-05-29 Thread kidandcat
proc newDOMParser(): JsObject {.importcpp:"new DOMParser()", nodecl.} proc fetchEPG(): void {.async.} = var res = await fetchText("/epg.xml") var parser = newDOMParser(); var xmlDoc = parser.parseFromString(res,"text/xml"); log xmlDoc EPG = xmlDoc

Re: xmldomparser on frontend - compile to javascript

2019-05-29 Thread domogled
OK, xmldomparser use stream and streams are not available for JS backend. htmlparser library too. How I can parse xml on frontend in nim with compile js? thanks

Re: xmldomparser on frontend - compile to javascript

2019-05-29 Thread domogled
nim -v Nim Compiler Version 0.19.9 [Linux: amd64] Compiled at 2019-05-18 Copyright (c) 2006-2019 by Andreas Rumpf active boot switches: -d:release

Re: xmldomparser on frontend - compile to javascript

2019-05-29 Thread miran
>From `streams.nim`: when not defined(js): type StringStream* = ref StringStreamObj ## A stream that encapsulates a string. ## ## **Note:** Not available for JS backend. # (...) proc newStringStream*(s: string =

wNim fork with ZeeGrid control

2019-05-29 Thread bunkford
I forked wNim and added the Zeegrid control if anyone is interested. > ZeeGrid is created by by David Hillard > ([http://www.kycsepp.com/](http://www.kycsepp.com/)) GitHub link: [https://github.com/bunkford/wNim](https://github.com/bunkford/wNim) Documentation: [https://bunkford.github.io

Re: Shared library for Android

2019-05-29 Thread akavel
Hi Sergey! If you have Android NDK installed, it should be possible. I did this for a simple "hello world" app, see: [https://github.com/akavel/hellomello/#build-steps](https://github.com/akavel/hellomello/#build-steps) (part of a [bigger project](https://forum.nim-lang.org/t/4840)). Also, anot

Re: method call syntax for more than one argument?

2019-05-29 Thread mratsim
You can probably use a `forth` macro that would do: forth: c.b.a.f Run

Re: I think we can really do better...

2019-05-29 Thread mratsim
I actually think it's easier to optimize Nim for scientific computing like I did for the Julia challenge: [https://nextjournal.com/sdanisch/the-julia-challenge](https://nextjournal.com/sdanisch/the-julia-challenge) For example my [matmul implementation](https://github.com/numforge/laser/blob/bf

Re: xmldomparser on frontend - compile to javascript

2019-05-29 Thread mratsim
What is your nim compiler version ? (`nim -v`)

Re: Disadvantages of static proc parameters?

2019-05-29 Thread mratsim
In that case ^ is a library function and will be in a different module from where it's used. So you need either `static` or `{.inline.}` so that respectively Nim VM or the C compiler does constant folding. Also while C compilers certainly does constant propagation of add, mul, or/and/xor, shift

method call syntax for more than one argument?

2019-05-29 Thread omp
You know how a.f is equivalent to f(a)? Would it be possible, using macros, to write b.a.f to represent f(a,b), or c.b.a.f to represent f(a,b,c), and so on for any number of arguments? (It makes sense to do b.a.f instead of a.b.f because doing the former is like partially applying f to a, and t

Re: Is there a 'protected' or module-local scope modifier?

2019-05-29 Thread trtt
I still need to export the types and I'm not going to create another layer of wrappers just for that. This is not about fool-proofing but about not exposing the internal state for no reason.