This code got compiled but not works correctly

2021-07-23 Thread Mandofskii
(* using nimpy ) code : import nimpy py = pyBuiltinsModule() discard py.open("file.txt", "w").write("Hello Nim!") (* File created but its empty)

Nim online playground using Monaco and Wandbox api

2021-07-23 Thread doongjohn
I just made it for fun. If anyone finds this useful, that's awesome ;)

two questions on Import relating to strip

2021-07-23 Thread JPLRouge
Hello, too bad that strip, align is also in unicode under the same name, we are forced to make exceptions ... Second question: in my source can I for example mysource: import strutils import mymodule mymodule : import strutils except strip import unicode and if I understood correctly the impor

More Nim on more Microcontrollers!? (Arm CMSIS / Zephyr RTOS)

2021-07-23 Thread auxym
Came across this, could be an interesting approach? It's a code generator that takes in SVD files, which describe hardware and peripherals in a standardized XML format, and outputs zig code. Bonus: we wouldn't need clojure to parse the xml :P For example, i

Need confirmation this code causes a `SIGSEGV: Illegal storage access`

2021-07-23 Thread stu002
Excellent explanation, thanks.

Need confirmation this code causes a `SIGSEGV: Illegal storage access`

2021-07-23 Thread stu002
Many thanks for that -- I realize now the parentheses are crucial to make the `proc` into some kind of expression.

Youtube "Software Drag Racing" to count primes in Nim

2021-07-23 Thread ingo
Relative small community and fragmentation (says an old git who loved USENET).

What is the purpose of do notation

2021-07-23 Thread Araq
> Now I see why it is so :). Because it's a hack that doesn't look good enough > to be included into the language. But that's a sad news. Type infer, at the > very least for anonymous functions, is very useful and important feature... 1. No, it's not a very "important feature", it's pretty muc

random async exception when downloading

2021-07-23 Thread xioren
No, Debian testing has 1.4.2.

random async exception when downloading

2021-07-23 Thread enthus1ast
Might be that one of your functions return, then you have none left.

random async exception when downloading

2021-07-23 Thread yglukhov
Have you tried with nim 1.4.8 or later? There was a fix for this.

What is the purpose of do notation

2021-07-23 Thread juancarlospaco
Pass result as argument, then it wont use auto

random async exception when downloading

2021-07-23 Thread xioren
I have a youtube downloader that works fine 99% of the time however sometimes, seemingly at random the download will fail with this (async) error: Error: unhandled exception: No handles or timers registered in dispatcher. [ValueError] Run Any ideas on what might cause th

Youtube "Software Drag Racing" to count primes in Nim

2021-07-23 Thread RattleyCooper
> Surprising he mentions V/Zig so much without even touching on Nim in the > first video. I think that speaks to a deficiency in Nim's PR. Any thoughts > why this might be? When I was looking in to Nim I didn't think there was a very active community because there didn't seem to be much activit

What is the purpose of do notation

2021-07-23 Thread dom96
> Now I see why it is so :). Because it's a hack that doesn't look good enough > to be included into the language. But that's a sad news. Type infer, at the > very least for anonymous functions, is very useful and important feature... I dunno, I wouldn't call the `=>` itself a hack, it uses what

What is the purpose of do notation

2021-07-23 Thread alexeypetrushin
> This is the same old problem — Nim doesn't have backward type inference. The > => macro does argument type “inference” in a hacky way by making the function > generic, but I'm not sure if that's appropriate for a language construct. Aha... it explains this mystery. I was always wondering why `

Nim online meetup - Friday July 23rd

2021-07-23 Thread juancarlospaco
Another alternative, streams live to Youtube, Twitch, Facebook, VK, Twitter and more, with bridged chat, no watermark, works with OBS, free

Nim online meetup - Friday July 23rd

2021-07-23 Thread stefantalpalaru
We all had moderator rights. It seems Jitsi has weird permissions by default:

What is the purpose of do notation

2021-07-23 Thread haxscramper
test _12_

What is the purpose of do notation

2021-07-23 Thread juancarlospaco
I was not against nor in favor of it, it was just raw new-user feedback.

What is the purpose of do notation

2021-07-23 Thread haxscramper
It does not really make sense to put two-three line procedure (that might also be a closure btw, so it can't really be moved to toplevel) to the toplevel, and cramming all of this in the `=>` notation is not always possible as well.

What is the purpose of do notation

2021-07-23 Thread dom96
Regarding `quote do`, I see no reason why the `do` is necessary for this. Still waiting for someone to explain why it uses `do`. Why can't `quote` just work? Regarding @yglukhov's examples, personally I think the proc syntax is perfectly good, your style just needs a tweak :) foo(a

What is the purpose of do notation

2021-07-23 Thread Araq
> but I'm not sure if that's appropriate for a language construct. I think it's completely acceptable. Esp for alexeypetrushin.

What is the purpose of do notation

2021-07-23 Thread xigoi
This is the same old problem — Nim doesn't have backward type inference. The `=>` macro does argument type “inference” in a hacky way by making the function generic, but I'm not sure if that's appropriate for a language construct.

Nim online meetup - Friday July 23rd

2021-07-23 Thread miran
> Will meetups be available as on-demand vids? We will record today's meetup (which is in exactly 2 hours from now!) and it will be available on [our Youtube channel](https://www.youtube.com/channel/UCDAYn_VFt0VisL5-1a5Dk7Q) at some point in the future :)

What is the purpose of do notation

2021-07-23 Thread alexeypetrushin
> 1 do is used frequently, see posts above of yours. > 2 do works as it is > documented, see point (1) > 3 Ruby had no significant influence on Nim's > design, sorry. 1. Ok, maybe, although I don't think `do` is used frequently, and I haven't seen such usage in other's people code. 2. I phr

Youtube "Software Drag Racing" to count primes in Nim

2021-07-23 Thread GordonBGood
@GamezWithjamz: > > If you want me to win this competition... > @GordonBGood Yes, that is > > exactly why I posted this here... I've got this licked. It turns out that there were a few issues with the current Nim implementations, among them that the author specified an "Alpine" Docker image th

Nim online meetup - Friday July 23rd

2021-07-23 Thread gemath
Will meetups be available as on-demand vids?

Need confirmation this code causes a `SIGSEGV: Illegal storage access`

2021-07-23 Thread demotomohiro
Declaring a proc with name is a statement. If it was an expression, we have to declare procedures like `discard proc foo() =`. An anonymous proc is an expression and we have to pass it into other procedure, store it to variable or return from a proc. Otherwise, there is no way to call it. I th

What is the purpose of do notation

2021-07-23 Thread yglukhov
We have 873 `do`\- lambda occurrences in our private codebase :) . Although they can be replaced with anonymous procs, they slightly add to syntactical ergonomics and readability IMO. Compare this: foo(a, b) do(c, d: int) -> int: # Some body here return c + d

What is the purpose of do notation

2021-07-23 Thread Araq
Well... > Situation is similar here. Nobody uses it because do implemented poorly. I > from Ruby experience, like do, and tried to use it in Nim. But it doesn't > work. 1. `do` is used frequently, see posts above of yours. 2. `do` works as it is documented, see point (1) 3. Ruby had no si

Need confirmation this code causes a `SIGSEGV: Illegal storage access`

2021-07-23 Thread ynfle
This is a sugarized version that also works import sugar func uncurry*[T, U, V](fn: (T, U) -> V): ((T, U)) -> V = result = (xs: (T, U)) => fn(xs[0], xs[1]) func add(a: int, b: int): int = a + b echo (uncurry(add))((1,2)) Run

Need confirmation this code causes a `SIGSEGV: Illegal storage access`

2021-07-23 Thread ynfle
This works totally fine func uncurry*[T, U, V](fn: proc (x: T, y: U): V {.nimcall}): (proc (xs: (T, U)): V {.closure.}) = result = (proc (xs: (T, U)): V {.closure.} = fn(xs[0], xs[1])) func add(a: int, b: int): int = a + b echo (uncurry(add))((1,2))