<< 05-11-2021 >>

00:06:26FromDiscord<willyboar> This sounds interesting
00:20:39*Guest40 joined #nim
00:22:49*Guest40 quit (Client Quit)
00:27:15FromDiscord<evoalg> sent a long message, see http://ix.io/3E3v
00:28:50FromDiscord<leorize> a template might be better for that
00:29:29FromDiscord<leorize> a proc in there would cause the creation of closures and closures in loops are weird
00:33:08FromDiscord<evoalg> ok thanks ... Im not up to that part of my nim learning yet, but I'll look out for them for it
01:21:41*krux02 quit (Remote host closed the connection)
02:38:01*arkurious quit (Quit: Leaving)
02:39:15FromDiscord<codic> I tried some random shit and now my wm works
02:39:33FromDiscord<codic> Now I have a Nimble question, can I build 2 binaries in 1 nimble package?
02:39:35FromDiscord<codic> If so, how?
02:40:06*mahlon quit (Ping timeout: 268 seconds)
02:43:10FromDiscord<Elegantbeef> `bin = @[]` stuff
02:43:47FromDiscord<codic> cool
02:43:57FromDiscord<codic> i want one binary for my actual wm and one for the ipc client
02:44:06FromDiscord<codic> `bin = @[ worm, wormc ] `
02:44:21FromDiscord<codic> (edit) "worm, wormc" => ""worm", "wormc""
03:14:07*mahlon joined #nim
03:59:31*lane joined #nim
04:02:53nrds<Prestige99> Is there a way to echo the name of a param passed into a template?
04:03:38nrds<Prestige99> like if I have a template foo, and a variable bar = 5, I call foo(bar) I want to echo out "bar"
04:03:47FromDiscord<Elegantbeef> `static echo astToStr(yourVar)`
04:05:51nrds<Prestige99> hm I must be missing something, not seeing anything printed
04:06:01*supakeen quit (Quit: WeeChat 3.3)
04:06:28nrds<Prestige99> like https://play.nim-lang.org/#ix=3E4d ?
04:06:31*supakeen joined #nim
04:06:46FromDiscord<Elegantbeef> it echos out bar at CT
04:06:51FromDiscord<Elegantbeef> if you want it at runtime remove static
04:07:06nrds<Prestige99> ah thanks
04:07:17nrds<Prestige99> Guess the playground doesn't show compile time echos
04:07:49FromDiscord<Elegantbeef> Yea it does
04:08:17nrds<Prestige99> Mm there's a toggle button for output, I see
04:08:23nrds<Prestige99> Well thanks beef this helps a lot
04:08:26FromDiscord<Elegantbeef> Yep
04:08:37FromDiscord<Elegantbeef> As always you're not welcome
04:08:41FromDiscord<Elegantbeef> Wait that's not it
04:09:17nrds<Prestige99> Lol :P
04:30:27FromDiscord<evoalg> what does AST stand for in astToStr ?
04:30:38FromDiscord<Elegantbeef> abstract syntax tree
04:30:51FromDiscord<evoalg> oooooo ok
04:31:57FromDiscord<Elegantbeef> So if prestige did `foo(bar[0])` it'd echo `bar[0]`
04:34:50FromDiscord<evoalg> nice
04:45:45FromDiscord<evoalg> for a func, there's a way to print things for debugging ... I saw it somewhere but it's hard to find?
04:46:26FromDiscord<Elegantbeef> `debugecho`
04:47:10FromDiscord<leorize> debugEcho is just side-effect-less echo for the most part
04:47:20FromDiscord<leorize> I think there's an actual debug macro these days
04:47:37FromDiscord<evoalg> debugecho, nice ๐Ÿ˜‰
04:48:24FromDiscord<evoalg> debug macro ... I haven't seen that yet
04:48:28FromDiscord<evoalg> Thanks!
05:07:07*rockcavera quit (Remote host closed the connection)
05:29:53FromDiscord<evoalg> The best practices github says `Prefer in-place functions, for example, sort instead of sorted where appropriate.` Is this because it's faster or because it uses less mem?
05:31:15FromDiscord<Elegantbeef> A bit of both
05:31:58FromDiscord<evoalg> ok thanks
05:32:01FromDiscord<Elegantbeef> If you're sorting a bunch of things sorted allocates more which will slow down the process
05:34:59FromDiscord<evoalg> a bunch of things like a really long seq?, or do you mean lots of seq's?
05:35:08FromDiscord<Elegantbeef> The latter
05:35:37FromDiscord<Elegantbeef> Allocating new sequences requires talking to the OS/allocator so it'll be slower than just using already allocated memory
05:36:02FromDiscord<evoalg> ahh I see that makes sense - thank you
05:36:58FromDiscord<Elegantbeef> It's also why you may want to call `setLen` to preallocate to a given size
05:37:14FromDiscord<Elegantbeef> By default though i think all collections are allocated to 64 entires
05:37:18FromDiscord<evoalg> oh so that could speed things up?
05:37:47FromDiscord<Elegantbeef> Yea if you're adding a lot, cause it doesnt have to talk to the allocation logic so it just puts the data at the index then increases the capacity
05:38:24FromDiscord<Elegantbeef> I mean increase count not capacity
05:38:56FromDiscord<evoalg> Nice! ... that best practices says what to do but doesn't really explain why. It'll be good when you write that book that pmunch said you're writing
05:39:13FromDiscord<Elegantbeef> I'm writing a book?
05:39:47FromDiscord<evoalg> I'm being cheeky, referring an earlier discussion
05:39:59FromDiscord<Elegantbeef> Oh right
05:40:06FromDiscord<evoalg> ... but I'm meaning it as a compliment
05:40:08FromDiscord<Elegantbeef> someone actually back reads
05:43:26FromDiscord<evoalg> speaking of speed ... I've only ever used int's and nothing like int8 or whatever because I read that the process will do int's just as fast, and I'm worried about speed not memory ... but for a bunch of ints it that still true?
05:44:32FromDiscord<evoalg> processor
05:44:56FromDiscord<Rika> Unless youโ€™re explicitly using SIMD then there is no difference
05:45:20FromDiscord<Rika> Well, there can be but it involves a lot more integers than regular use
05:45:42FromDiscord<evoalg> yay I can ignore them then - thank you
05:47:53FromDiscord<Elegantbeef> You generally use them for when you only need that information
05:49:28FromDiscord<Elegantbeef> IE if you only need 255 unsigned values you use uint8 ๐Ÿ˜€
05:50:26FromDiscord<Elegantbeef> Then you can use enums/ranges for even smaller selections ๐Ÿ˜€
05:51:52FromDiscord<evoalg> why would you used uint8 instead of int ... just to save memory and not wasteful and beautiful, but not because of speed right?
05:52:09FromDiscord<Elegantbeef> Memory and dont need 64bits
05:52:32FromDiscord<Elegantbeef> depending on what you're doing 64bit gives you way more room for errors
05:53:23FromDiscord<evoalg> meaning that you could catch errors earlier and easier if you defined a smaller amount
05:54:13FromDiscord<Elegantbeef> Well you can prevent wrong values at compiletime/runtime without issue
05:55:01FromDiscord<Elegantbeef> Otherwise you need to use a range type `var a: range[0..255]` ๐Ÿ˜›
05:56:26FromDiscord<evoalg> I understand - thank you
05:56:58FromDiscord<Elegantbeef> The nim type system has a bunch of nice features for runtime/compiletime value assurance
05:59:13FromDiscord<evoalg> it's more for me to remember and I'd need to be mindful of it when writing the code, but it's the proper way of doing it as it will lead to less buggy code ... unlike lazy me who just uses ints all the time for everthing
06:01:17FromDiscord<Elegantbeef> Yea distincts and ranges really allow you to prevent bugs
06:03:04FromDiscord<Elegantbeef> For an example of a distinct in action if interested https://forum.nim-lang.org/t/8576#55735
06:03:14FromDiscord<evoalg> ok ... you said by setting the length beforehand, there'd be less mem calls to allocate mem ... but if I set the length of a seq then I'd just use an array instead and not a seq right?
06:03:33FromDiscord<Elegantbeef> That only works if the len is known at compile time
06:03:56FromDiscord<Elegantbeef> Say you're reading a file that stores`size, elements`
06:04:45FromDiscord<Elegantbeef> You read the size, then set the sequences capacity(`newSeqOfCap`) to `size` then just iterate and add and dont have any more memory allocations
06:05:08FromDiscord<evoalg> ahhhh I see okay
06:05:30FromDiscord<evoalg> "You have a distinct string that you use when you dont trust the source you got a string from" <-- that's cunning
06:08:00FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3E4s
06:08:05FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3E4t
06:08:20FromDiscord<Elegantbeef> .1ms faster roughly
06:08:42FromDiscord<Elegantbeef> Not much in this case but each entry is only 4 bytes, change it to something bigger and it gets interesting ๐Ÿ˜›
06:09:52FromDiscord<evoalg> I guess it get get exponentially slower
06:10:16FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3E4u
06:10:34FromDiscord<Elegantbeef> Twice as fast without any extra effort
06:10:54FromDiscord<evoalg> wow great example!
06:11:47FromDiscord<evoalg> Thanks for the example ... newSeqOfCap <-- I've looked at that before, and I read the system module about it, but I was confused as it didn't tell me what "cap" was ... but yea an example really shows it - thank you
06:13:33FromDiscord<evoalg> Also I didn't know about benchy ... I was using "import timeit" and and then using "timeGo"
06:14:03FromDiscord<Elegantbeef> Benchy is just treeforms benchmark library
06:14:10FromDiscord<Elegantbeef> timeit does similar afaik
06:14:47FromDiscord<Elegantbeef> Timeit gives more information(smaller times) but treeform does nice outputs ๐Ÿ˜€
06:15:23FromDiscord<evoalg> right ๐Ÿ™‚
06:15:54FromDiscord<evoalg> I really like treeforms print too ... so nice
06:18:34FromDiscord<evoalg> what does `keep data` do in your examples?
06:18:54FromDiscord<Elegantbeef> Treeform has some logic to ensure a value isnt optimized away
06:19:09FromDiscord<Elegantbeef> The C compiler is smart and may optimize values out that are unused
06:19:24FromDiscord<evoalg> ohhhh I see nice
06:20:10FromDiscord<impbox [ftsf]> has anyone made a nim based wiki anywhere?
06:20:19FromDiscord<dangbinghoo> hi, what's the difference of --os:any and --os:standalone ?
06:20:28FromDiscord<impbox [ftsf]> it's very hard to search for "wiki" >_<
06:20:44FromDiscord<Elegantbeef> I dont think so imp, or i havent seen any
06:20:54FromDiscord<Elegantbeef> I think standalone has been deprecated for any
06:21:01FromDiscord<evoalg> In reply to @impbox "has anyone made a": that would be awesome
06:21:13FromDiscord<Elegantbeef> Well there is the wiki on the github page
06:21:25FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/wiki
06:21:47FromDiscord<dangbinghoo> In reply to @Elegantbeef "I think standalone has": ok, thanks
06:21:54FromDiscord<impbox [ftsf]> i don't think that's made in nim though?
06:22:03FromDiscord<Elegantbeef> Oh you mean wiki nim implementations
06:22:07FromDiscord<impbox [ftsf]> that's github's wiki... would be cool if they used nim
06:22:10FromDiscord<Elegantbeef> I thought you meant wikis for nim
06:22:18FromDiscord<impbox [ftsf]> yeah, a wiki made in nim
06:22:28*FromDiscord quit (Remote host closed the connection)
06:22:41*FromDiscord joined #nim
06:22:54FromDiscord<Elegantbeef> Rereading your question it's obvious now
06:23:03FromDiscord<dangbinghoo> I found that os:standalone needs user must supply panicoverride.nim in prj dir, and os:any just don't
06:23:43FromDiscord<impbox [ftsf]> fair, i don't want to write a wiki either =p
06:26:13FromDiscord<evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3E4D
07:28:37*kenran joined #nim
07:57:41*lane quit (Ping timeout: 268 seconds)
08:12:03FromDiscord<ratapenado> Hello, it seems that "nim c test.nim" manage to find the libraries imported but "nimble build" requires to add the imports in the .nimble file. Why is that ?
08:12:51FromDiscord<Elegantbeef> Cause nimble clears the path to make it more reproducable
08:16:08FromDiscord<Rika> Reproducible
08:23:10FromDiscord<ratapenado> Sorry, what do you mean by clear the path ?
08:23:46FromDiscord<Elegantbeef> It removes the nimble files from being accessible then adds only those that are `require`'d back
08:24:22FromDiscord<Rika> Itโ€™s so that when you install it in a clean install of Nim it will still work
08:27:56FromDiscord<ratapenado> Allright thanks !
08:35:11NimEventerNew thread by Didlybom: Include std/prelude vs import std/prelude (and other small prelude oddities), see https://forum.nim-lang.org/t/8591
08:43:32FromDiscord<evoalg> sent a long message, see http://ix.io/3E5i
08:45:26FromDiscord<Elegantbeef> [leorize](https://matrix.to/#/@leorize:envs.net)\: would know best
08:45:52FromDiscord<Elegantbeef> But he's probably asleep now so...
08:46:19FromDiscord<evoalg> Thank you ... gosh you don't need sleep it seems LOL
08:46:30FromDiscord<evoalg> I mean it's late for you
08:46:32FromDiscord<Elegantbeef> Well i'm about to go to sleep soon
08:46:33FromDiscord<Elegantbeef> So...
08:46:43FromDiscord<Elegantbeef> Only 3am, i'm useless afterall
08:47:02FromDiscord<Rika> Lol
08:47:22FromDiscord<Rika> Can you link your init vim?
08:47:33FromDiscord<Rika> Iโ€™ll at least try and see
08:51:04FromDiscord<evoalg> I can paste it somewhere sure ... hang on .... https://www.paste.org/120339
08:51:22FromDiscord<evoalg> geez I didn't know where to paste it ... I had to google
08:51:53FromDiscord<enthus1ast> HTTP ERROR 500 lol
08:51:57FromDiscord<enthus1ast> you broke it \:)
08:52:04FromDiscord<Rika> Nothing looks wrong about it
08:52:08FromDiscord<Rika> I could load it
08:53:17FromDiscord<evoalg> maybe it's me using nvim on linux which is on docker running on my mac
08:53:33FromDiscord<Rika> Youโ€™re crazy
08:53:53FromDiscord<Elegantbeef> You have the wrong OS sandboxed
08:54:03FromDiscord<enthus1ast> include APPLE\_RANT\_1
10:03:23NimEventerNew thread by Benjamindlee: How to make a proc with a default genetic type that can be inferred at compile time?, see https://forum.nim-lang.org/t/8592
10:39:03*krux02 joined #nim
11:50:52FromDiscord<deech> Why can't `none(MyType)` infer `MyType`? Especially when the type is bigger like `seq[tuple[...` it gets pretty cluttered to the point where `Option` is difficult to use without `matching` or ugly `if isSome: ... else: ...` statemetns.
11:58:49FromDiscord<Rika> nim doesnt have reverse inference afaik
11:59:36FromDiscord<Rika> `var a = sometype` (<-) works but you cant get `var a: Option[T] = none` (->) to work afaik
12:03:06FromDiscord<dom96> you can do `var a = none[T]()`
12:03:09FromDiscord<dom96> iirc
12:03:49FromDiscord<dom96> but yeah, this can't be inferred
12:04:05FromDiscord<dom96> I read the discussion in the wrong order ๐Ÿ™‚
12:06:02*supakeen quit (Quit: WeeChat 3.3)
12:06:31*supakeen joined #nim
12:19:48*kenran quit (Quit: WeeChat info:version)
12:38:09FromDiscord<deech> I would suggest then that pattern matching for `Option` should be provided by the `options` module so we don't have to take on a `fusion` dependency.
12:50:57FromDiscord<IsaacPaul> In reply to @dangbinghoo "hi, what's the difference": it also seems standalone users an array + bump pointer for allocation.. I'm not sure what 'any' does tho..โ†ตhttps://github.com/nim-lang/Nim/blob/f2f15e972645496f901fcfde197048de368453d6/lib/system/osalloc.nim#L195
12:51:08FromDiscord<IsaacPaul> (edit) "users" => "uses"
12:54:35FromDiscord<0ffh> sent a long message, see http://ix.io/3E6A
12:55:12FromDiscord<0ffh> oops, backtips seem to do some kind of formatting in discord...
12:55:20FromDiscord<0ffh> (edit) "backtips" => "backtics"
12:55:27FromDiscord<0ffh> (edit) "backtics" => "backticks"
12:56:32FromDiscord<0ffh> (edit) "http://ix.io/3E6A" => "http://ix.io/3E6C"
12:58:00FromDiscord<0ffh> i've replaced the backticks with normal ticks in the code
13:04:34FromDiscord<demotomohiro> Your macro works for me.
13:06:03FromDiscord<0ffh> lol, that's interesting! ๐Ÿ˜†
13:06:33FromDiscord<0ffh> what version?
13:06:36FromDiscord<0ffh> i'm 1.6
13:06:45FromDiscord<demotomohiro> im devel nim
13:07:17FromDiscord<0ffh> hmmm, i think i'll do some choosenim in the console and try it out
13:07:59FromDiscord<demotomohiro> How do you call it?โ†ตYou cannot use method call syntax for untyped parameter
13:09:25FromDiscord<0ffh> `def x 3f`
13:13:52FromDiscord<demotomohiro> def x, 3f works
13:14:11FromDiscord<0ffh> d'oh!โ†ตthanks!
13:14:22FromDiscord<0ffh> so i need the comma?
13:14:44FromDiscord<0ffh> no way to just use juxtaposition?
13:18:00FromDiscord<demotomohiro> !eval import macros; dumpTree: def x 3f
13:18:03NimBot<no output>
13:19:13FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3E6O
13:19:37FromDiscord<0ffh> thank, i will
13:19:42FromDiscord<0ffh> (edit) "thank," => "thanks,"
13:20:22FromDiscord<0ffh> ah it interprets the x as another ocmmand
13:20:29FromDiscord<demotomohiro> Nim parses it as command invocation syntax as def(x(3f))
13:35:46*rockcavera joined #nim
13:35:47*rockcavera quit (Changing host)
13:35:47*rockcavera joined #nim
13:49:19*arkurious joined #nim
13:52:35FromDiscord<Ricky Spanish> how does nim's runtime memory size compare to golangs? im trying to decide if its worth rewriting a small raspberry pi application i wrote in golang a while ago because id prefer it takes less memory
13:56:25FromDiscord<Stuffe> Is it known when the next stable patch for Nim 1.6 might be?
13:56:30*Vladar joined #nim
13:57:14FromDiscord<Stuffe> currently 1.6 doesn't work with older versions of glibc
13:57:34FromDiscord<Stuffe> but I see a fix is already committed to the dev branch
14:02:00NimEventerNew thread by Xioren: Best way to turn byte array into int?, see https://forum.nim-lang.org/t/8593
14:27:34FromDiscord<tandy> is anyone here familiar with the Minimax algorithm?
16:01:03*anjovi quit (Remote host closed the connection)
16:01:21*anjovi joined #nim
16:04:27*anjovi quit (Remote host closed the connection)
16:04:53*anjovi joined #nim
16:07:25FromDiscord<juan_carlos> Would be cool a blog post explaining how to do something like this for new people, at least in a brief way with a simpler "hello world", also I can not find the source code of `nicoscript` module, I do not think all people understand that is running without calling a compiler on a backend tho, congrats for the demo it looks awesome: https://www.jasonbeetham.com/snake/nicoscripter.html
16:35:44FromDiscord<treeform> Does any one know if there are code analysts tools for Nim like Cyclomatic complexity? Or some sort of other branch factor etc? After listening to Casey Muratori I would like to programmatically measure the quality of my code. But there seems to be little research into this.
16:38:30FromDiscord<treeform> Probably test code coverage would be a better one.
16:51:36FromDiscord<dom96> iirc the most popular tool for cyclomatic complexity does support Nim
16:51:42FromDiscord<dom96> I could be misremembering though
16:51:54FromDiscord<Rika> which is?
16:53:15FromDiscord<dom96> Can't remember lol
16:54:49FromDiscord<Rika> damn
17:09:17*stkrdknmibalz joined #nim
17:11:00*rockcavera quit (Remote host closed the connection)
17:18:34NimEventerNew thread by Manatlan: Compute a Sha256 : the fastest implem ?, see https://forum.nim-lang.org/t/8594
17:44:35NimEventerNew Nimble package! htmlToVdom - Karax extension to convert html in string form to embeddable Karax vdom, see https://github.com/C-NERD/htmlToVdom
18:02:42FromDiscord<Zoom> Is there a reason `readRow` in `std/parsecsv` is a proc\: bool and not an iterator?
18:03:21FromDiscord<tandy> doesnt this already exist?โ†ต(<@709044657232936960_=4eim=45venter=5b=49=52=43=5d>)
18:24:53NimEventerNew thread by Alpine: CreateDir on Windows using URL, see https://forum.nim-lang.org/t/8595
19:05:06*ormiret quit (Ping timeout: 245 seconds)
19:06:30*ormiret joined #nim
19:22:48*flynn0 joined #nim
19:22:53*NimEventer quit (Ping timeout: 268 seconds)
19:23:22*NimEventer joined #nim
19:23:26*flynn quit (Ping timeout: 245 seconds)
19:23:26*flynn0 is now known as flynn
20:03:10*flynn quit (Quit: Ping timeout (120 seconds))
20:04:22*flynn joined #nim
20:06:10*xet7 quit (Remote host closed the connection)
20:07:17*xet7 joined #nim
20:20:09*xet7 quit (Ping timeout: 268 seconds)
20:20:46*xet7 joined #nim
20:21:13*xet7 quit (Remote host closed the connection)
20:21:39*xet7 joined #nim
20:22:47FromDiscord<Ty> Hey, folks. I'm trying to understand the differences between lisp macros and nim macros. Are there any resources that have a detailed comparison?
20:50:36FromDiscord<Elegantbeef> @Ty\: i dont think there is, the main difference i think is that the Nim ast is larger and slightly more complicated. I guess also that they're written in Nim instead of lisp ๐Ÿ˜€
21:01:37*cyraxjoe quit (Quit: I'm out!)
21:03:16*cyraxjoe joined #nim
21:26:31*mst_ joined #nim
21:27:09*mst_ quit (Changing host)
21:27:10*mst_ joined #nim
21:27:15*happycorsair[m] quit (Ping timeout: 268 seconds)
21:27:29*mst quit (Killed (sodium.libera.chat (Nickname regained by services)))
21:27:29*mst_ is now known as mst
21:36:46*happycorsair[m] joined #nim
22:06:18tkhow do you pass a nim proc to an imported C function expecting a ptr to a proc?
22:08:08FromDiscord<Elegantbeef> declare it with `{.cdecl.}`
22:09:03tkthanks
22:48:54*Vladar quit (Quit: Leaving)
23:16:46*asd quit (Ping timeout: 245 seconds)