block-level change default type of int literals?

2021-09-25 Thread haxscramper
It is needed because otherwise `asI` evaluates as nil as mentioned by @ggibson. I'm not sure if this is a bug or not, but with copyNimNode it does generate nil.

block-level change default type of int literals?

2021-09-25 Thread fae_
It is quite impressive what (and how quickly) many members of the community are able to do with macros

Sieve of Erastothenes

2021-09-25 Thread Fire
The limit +% 1 should have been just limit.

block-level change default type of int literals?

2021-09-25 Thread ggibson
Wow, you are fast! I was not looking forward to figuring out how to macro that again. Thank you for mocking that up and sharing. Same curious question as @shirleyquirk, why is `copyNimNode` necessary? I see that the macro `asI` evaluated to `nil` later if it's not used.

HolyC as compilation target

2021-09-25 Thread robb1e
they are speaking to me

HolyC as compilation target

2021-09-25 Thread v3ss0n
Go out and look at the skies, if you see the cloud moving , they aren't clouds , they are flying glowies coming to get you.

HolyC as compilation target

2021-09-25 Thread robb1e
if you keep pressing F7 he will tell you about god, he's still here teaching us about our lord

HolyC as compilation target

2021-09-25 Thread v3ss0n
@robb1e Don't do it , i warn you , glow in the darks gonna come get you.

HolyC as compilation target

2021-09-25 Thread v3ss0n
He live in his OS now. Safe from glowies.

tesseract in nim?

2021-09-25 Thread elcritch
That's the right place to start. Unfortunately since C libraries often have oddities like random inline C macros before functions you generally need to configure c2nim to tell it how to handle certain things. It's often easier to do each header separately. Normally I take the route of just comm

Sieve of Erastothenes

2021-09-25 Thread Beliavsky
I'm new to Nim and tried the Sieve of Erastothenes program from Rosetta Code: from math import sqrt iterator primesUpto(limit: int): int = let sqrtLimit = int(sqrt(float64(limit))) var composites = newSeq[bool](limit + 1) for n in 2 .. sqrtLimit: # cull to s

block-level change default type of int literals?

2021-09-25 Thread shirleyquirk
Elegant stuff as always! What's the `copyNimNode` there to prevent?

Goodboy Galaxy - Kickstarter and demo now live!

2021-09-25 Thread exelotl
Hey folks, I figured I'd bump this as it's the [final day](https://www.kickstarter.com/projects/penguinrik/goodboy-galaxy-exploration-platform-game-gba-pc-and-switch/posts/3311349) of the Kickstarter. We hit 1000% of our original funding goal, which feels unreal. I'm really hopeful we can reach

HolyC as compilation target

2021-09-25 Thread Araq
Oh thank you! But I'm not _that_ smart and that probably helped Nim's design -- after all, who needs a better Haskell. :-)

HolyC as compilation target

2021-09-25 Thread Yardanico
After Araq of course :)

HolyC as compilation target

2021-09-25 Thread Niminem
Terry Davis was the smartest programmer that has ever lived

block-level change default type of int literals?

2021-09-25 Thread haxscramper
import std/macros macro intAs(asI, body: untyped): untyped = let asI = copyNimNode(asI) proc aux(node: NimNode): NimNode = case node.kind: of nnkIntLit: result = newCall(asI, node) of AtomicNodes - {nnkIntLit}: result = node else:

block-level change default type of int literals?

2021-09-25 Thread ggibson
I had asked and posted a pragma/macro to handle this a few years ago here, but stupidly didn't save it and can't find it anymore. Does there happen to be a feature I'm not finding in Nim 1.x+ that handles this? desired: proc somefn(input:int):int {.intAs: int32.}: var s =

Closures inside loops without capturing loop variable?

2021-09-25 Thread Araq
var fns: seq[proc()] for i in 0..10: closureScope: let p = i let w = proc() = echo p fns.add w for fn in fns: fn() Run does what you asked for, I think.

Closures inside loops without capturing loop variable?

2021-09-25 Thread DIzer
But I am not. An autocapture feature usually quirky in implementation.. - actually ,as for me an user should have possibility to mark a parameter should be captured explicitly. i was more surprised the fact that variable j seems over live the cycle where it is defined.

Closures inside loops without capturing loop variable?

2021-09-25 Thread DIzer
OK But why does not work next code? (there is no autocapture and local variable p made explicitly) It is bad from viewpoint of the language consistency. var fns: seq[proc: void] for i in 0..10: let w = proc(): auto = let p = i echo p fns.add w

Closures inside loops without capturing loop variable?

2021-09-25 Thread Araq
The language used to work this way, a fresh environment would be created for every loop iteration. We changed it for better performance and JavaScript interop. Not sure if it was the best decision ever but it comes up rarely enough and it's hard to get the same performance improvement with an op

tesseract in nim?

2021-09-25 Thread robb1e
i used c2nim --header --strict --cpp headernames.h Run where headernames.h are all the required headers

tesseract in nim?

2021-09-25 Thread Araq
> Yes, you're supposed to fix those manually :) Not really... You're supposed to configure c2nim properly.