Nim Nuggets: Talk About Nim At The Strange Loop Conference

2021-10-15 Thread bpr
Really outstanding talk, the demo of C++ interop was inspirational.

How to get n-th symbol of utf-8 string

2021-10-15 Thread xigoi
Note the difference: `runeAtPos` returns a `Rune` (the Unicode equivalent of `char`), `runeStrAtPos` returns a `string` (like in Python).

Nim Nuggets: Talk About Nim At The Strange Loop Conference

2021-10-15 Thread jmiven
I found them in the repo on github: (btw, thanks deech, great talk!)

How to overload procedure correctly?

2021-10-15 Thread xigoi
It's not _quite_ the same as in Python, because the concrete type must be known at compile time. But here it works.

Is there more simple way to solve this task?

2021-10-15 Thread jorjun_arch
type Point2D = tuple[x, y: float] func sumPoints(p1, p2: Point2D): Point2D = (p1.x + p2.x, p1.y + p2.y) echo sumPoints((x:1.0, y:2.0), (x:3.0, y:4.0)) Don't be repeating the type in the args, nor failing to qualify the x, y parameters in the call.

Nim Nuggets: Talk About Nim At The Strange Loop Conference

2021-10-15 Thread zetashift
Awesome talk, quickly became one of my favorites!

How to get n-th symbol of utf-8 string

2021-10-15 Thread DavideGalilei
Possible duplicate of , however this is what I came up with: import unicode let s = "Привет!" echo s.runeStrAtPos(1) Run Which outputs "р" Warning: as [stated in documentation](https

How to get n-th symbol of utf-8 string

2021-10-15 Thread Orlean
let s = "Привет!" echo s[1] # will not return 2nd symbol "п" Run How to get n-th symbol from unicoded string?

How to get n-th symbol of utf-8 string

2021-10-15 Thread haxscramper
https://nim-lang.org/docs/unicode.html#runeAtPos%2Cstring%2Cint

How to overload procedure correctly?

2021-10-15 Thread haxscramper
`proc sum(a: int, b: int): int = a + b proc sum(a: int | float, b: int | float): float = float(a) + float(b) echo sum(1, 2) echo sum(1.0, 2) echo sum(1, 2.0) echo sum(1.0, 2.0) ` Run

How to overload procedure correctly?

2021-10-15 Thread Orlean
Cool! `int | float` is like in Python 3.10! Many thanks!

How to overload procedure correctly?

2021-10-15 Thread juancarlospaco
It is basically what you want to do, but already done. You can sum int and float mixed and it works, after importing it `echo 1.0 + 2` works. You can see the source code

Question about procedure parameters

2021-10-15 Thread haxscramper
It does not matter whether you use let of var to declared variable inside of a procedure, it will all work the same. Procedure with `let nprinted = if nprinted == -1 : s.len else: min(nprinted, s.len)` is identical to `var nprinted = if nprinted == -1 : s.len else: min(nprinted, s.len)`, at leas

How to overload procedure correctly?

2021-10-15 Thread Orlean
I need to create a procedure to sum `a` and `b` (for study purposes). Variable `a` can be `int` or `float`, variable `b` can be `int` or `float` too. My code works, but I wonder if there is more simple way to do overloading: proc sum(a: int, b: int): int = a + b proc sum(a: int,

How to overload procedure correctly?

2021-10-15 Thread Orlean
According to your answer it seems to be available, but it's difficult for me to understand this material... Could you post how this will be look for my case?

How to overload procedure correctly?

2021-10-15 Thread juancarlospaco
?.

How to overload procedure correctly?

2021-10-15 Thread DavideGalilei
You can use generics like this: `proc sum[T, Y](a: T, b: Y): float = float(a) + float(b)`

Question about procedure parameters

2021-10-15 Thread Orlean
So, when I use `var` unstead of `let`, I will change procedure parameter, willn't I?

Question about procedure parameters

2021-10-15 Thread Orlean
According this in [Nim tutorial](https://nim-lang.org/docs/tut1.html#procedures-parameters): > Parameters are immutable in the procedure body. By default, their value > cannot be changed because this allows the compiler to implement parameter > passing in the most efficient way. If a mutable va

Nim access to OSX cut and paste buffer:

2021-10-15 Thread yglukhov
Also /

Question about procedure parameters

2021-10-15 Thread treeform
Let creates a new variable that happens to share the name with the argument. But they are different memory locations. This is what happens: proc printSeq(s: seq, nprinted0: int = -1) = let nprinted1 = if nprinted0 == -1 : s.len else: min(nprinted0, s.len) for i in 0

Nim access to OSX cut and paste buffer:

2021-10-15 Thread treeform
You could try GLFW: `install staticglfw`

Nim access to OSX cut and paste buffer:

2021-10-15 Thread DMisener
I'm trying to avoid _costly_ shelling out to pbcopy/pbpaste. import osproc, strutils proc pbpaste() : string = var exitCode: int; (result, exitCode) = execCmdEx "pbpaste" proc pbcopy(content: string) = discard execCmd "echo " & content.replace("\"",

Strange compilation error with Nim 1.4.6 on Mac

2021-10-15 Thread Jaap
i do get the same error on mac nim 1.5 with -d:release --gc:orc and --gc:arc

Nim Nuggets: Talk About Nim At The Strange Loop Conference

2021-10-15 Thread geotre
Great talk @deech! Would love to see the type migration macros

Strange compilation error with Nim 1.4.6 on Mac

2021-10-15 Thread togelonline
Bandar](https://167.71.221.72/'>Bandar) Togel Terbaik dan Terpercaya Aktif 24 Jam https://167.71.221.72/wp-content/uploads/2021/08/hometogel.gif>" alt="Togel Online" style="width:200px"> Bandar](https://167.71.221.72/'>Bandar) Togel Terpercaya Diskon Pasaran Terbesar https://167.71.221.72/wp-

Nanim: Inspired by 3b1b's manim, I created a GPU-accelerated framework for smooth animations in Nim!

2021-10-15 Thread miran
> I wrote something up and added the example above^ with more comments as well > as some more gifs: As I said in that link: > Hmmm, should this maybe be a separate "guest post" on our blog? This way, > @EriKWDev, you could go into more detail about

Nim Nuggets: Talk About Nim At The Strange Loop Conference

2021-10-15 Thread xigoi
Who still cares about ObjC?

Nim Nuggets: Talk About Nim At The Strange Loop Conference

2021-10-15 Thread Clonk
> No items or len

Nim 1.6.0 RC3

2021-10-15 Thread Clonk
> Well, it's always hard to say anything without a program. I know, but I fail to isolate a reproducible example so far, and the application in which that happens is too big to share the full code. If I manage to get a small example that reproduce i'll open an issue

Strange compilation error with Nim 1.4.6 on Mac

2021-10-15 Thread francisl
Also work fine for me. macOS 11.6 with the tools from Xcode 13 beta. gcc --version is Apple clang version 13.0.0 (clang-1300.0.29.3)

Nanim: Inspired by 3b1b's manim, I created a GPU-accelerated framework for smooth animations in Nim!

2021-10-15 Thread ErikWDev
I wrote something up and added the example above^ with more comments as well as some more gifs: :)

Nim Nuggets: Talk About Nim At The Strange Loop Conference

2021-10-15 Thread shirleyquirk
> Nim's tuples non-standard Yes, @deech, what about them is different?

Nim Nuggets: Talk About Nim At The Strange Loop Conference

2021-10-15 Thread ynfle
Great talk!

Nim Nuggets: Talk About Nim At The Strange Loop Conference

2021-10-15 Thread Dabod
Great talk. About supported backends, lack of objc ;)

Nim 1.6.0 RC3

2021-10-15 Thread Araq
> I have strange segfault using this version and --gc:arc regarding failure to > allocate memory. Well, it's always hard to say anything without a program.

Nim Nuggets: Talk About Nim At The Strange Loop Conference

2021-10-15 Thread sdmcallister
Great talk! Thank you!

Nim 1.6.0 RC3

2021-10-15 Thread Clonk
I have strange segfault using this version and --gc:arc regarding failure to allocate memory. Stacktrace looks like this; I'm not at 100% RAM usage when it occurs. signal (11): Segmentation fault in expression starting at none:0 rawAlloc_system_5636 at /home/rcaillaud/.cho

Nanim: Inspired by 3b1b's manim, I created a GPU-accelerated framework for smooth animations in Nim!

2021-10-15 Thread jorjun_arch
Hey, I am not a downer on digital art, far from it, since I started attempting it for the first time in 1983. I am actually delighted by how mainstream DA has become. But for standards to be high we have to allow criticism as well, I cannot stand this intolerant era of fragile egos that we are l

Nanim: Inspired by 3b1b's manim, I created a GPU-accelerated framework for smooth animations in Nim!

2021-10-15 Thread jorjun_arch
I would like to know more about how your carping at the opinion of others is somehow more relevant than my opinion. Are you upholding the values of community? Is that it?

Nim : Style insensitivity , snake_case , camelCase

2021-10-15 Thread xigoi
Here's a proof-of-concept Vim script that changes `snake_case` to `camelCase` when the cursor is on a different line. setlocal conceallevel=2 for i in range(1, 26) let upper = nr2char(64 + i) let lower = nr2char(96 + i) execute 'syntax match nimUnderscoreLetter

Nim Nuggets: Talk About Nim At The Strange Loop Conference

2021-10-15 Thread Araq
Why are Nim's tuples non-standard? They always used pretty standard to me...

Fortran to Nim?

2021-10-15 Thread rforcen
as there's a bunch of good fortran code out there, i've been fiddling on wrapping fortran 77 subroutines, it's as simple as with C but compatible real & double precision must generated with gfortran, i.e.: @gfortran -Ofast -c -fdefault-real-8 -fdefault-double-8 493.f R

Nim 1.6.0 RC3

2021-10-15 Thread AMoura
Can we have a ARM version download link in Nim website ? Because this versions exist no ?

Nim 1.6.0 RC3

2021-10-15 Thread pietroppeter
successfull switch to 1.6RC3 using choosenim on windows 🥳 C:\xxx>choosenim update self Updating choosenim [##] 100.0% 0kb/s Info: Updated choosenim to version 0.8.2 C:\xxx>choosenim "#version-1-6" Downl