<< 14-11-2020 >>

00:00:01FromDiscord<Gyllou> sry for pic spam
00:00:11FromDiscord<nikki> yo i didn't realize nim had a documentation website
00:00:37FromDiscord<Gyllou> are you being facetious?
00:00:45FromDiscord<nikki> yeah sorry lol i'm in friday silly mode
00:00:50PMunch@InventorMatt, well that's not good. But I think you might just be running into byte ordering
00:01:04FromDiscord<nikki> it happens between 3pm and 2am on fridays
00:01:16FromDiscord<Gyllou> lol kk i know im a nim noob just trying to link for that guy asking
00:01:25FromDiscord<Gyllou> metoo, im slightly drunk too
00:01:39FromDiscord<nikki> oh no hard feelings at all. it's great that this community is generally kinda nice and helpful to each other
00:01:49FromDiscord<nikki> that's one thing that i immediately felt when i got on this discord
00:01:57PMunchBinaryparse is strictly big endian IIRC
00:02:04FromDiscord<Gyllou> friday is my paper reading day so i usually get tired of that and start drinking wine at like 3pm
00:02:13disrupteki feel like we could totally smoke the competition with a proper graph library.
00:02:16FromDiscord<nikki> newspaper or like academic papers
00:02:25FromDiscord<Gyllou> i agree disruptek
00:02:28FromDiscord<Gyllou> academic papers
00:02:32disrupteklike, it's not hard to make really fast code in nim. we have the right level of abstraction for it.
00:02:39FromDiscord<InventorMatt> PMunch, when I do a manual approach to check it I am able to get the right result. I wonder what I may be doing wrong with your lib then
00:02:43FromDiscord<Gyllou> im aiming for totem level performance but thats a long way off
00:02:54FromDiscord<nikki> http://shape-of-code.coding-guidelines.com/2020/11/08/evidence-based-software-engineering-book-released/ this thing was posted on the webz recently if u want sth to read
00:02:57PMunchCheers Gyllou, I'm sitting here sipping a drink :)
00:03:12FromDiscord<Gyllou> its friday ya'll, gotsta
00:03:12disruptekits been a few years since i did graph stuff but it's central to my startup, so i am down to do some heavy lifting.
00:03:20FromDiscord<nikki> yeah i think nim can make anything as fast as you want. like there are no limits. bc you can literally generate or compile against whatever
00:03:29FromDiscord<nikki> and the normal code you write just is good
00:03:43FromDiscord<nikki> like what it generates to
00:03:56disrupteki am counting on cps for threading the algos.
00:03:57FromDiscord<nikki> except some times when i iterate through hash tables and it copies the entries out 😐
00:04:03FromDiscord<Gyllou> yea its very nice to change it up
00:04:07FromDiscord<nikki> i wish it just was a compile error to copy anything
00:04:11planetis[m]Hes dtg
00:04:15disrupteki mean, it can be.
00:04:19planetis[m]Down to graph
00:04:46FromDiscord<Gyllou> we have a speech module called phonographica we built in python, i'd love to port it over one day as well
00:04:56disruptekskiplists is >2.5x faster under arc. just a cli switch and boom.
00:05:39FromGitter<jrfondren> for my part I'm replacing various Rust and D utilities with Nim. It's very satisfying.
00:05:50disruptekwhat kinda utilities?
00:05:52FromDiscord<nikki> i think the right way to do that is to keep writing macros until you can just compile the python code you wrote; with nim
00:05:54FromDiscord<Gyllou> i have no desire to write an audio package for nim though. port audio is miserable to work with too
00:05:59PMunchInevntorMatt, could you try to call one of the `swapEndian` procedures from here on your number? https://nim-lang.org/docs/lib.html
00:06:07PMunchWoops, wrong link: https://nim-lang.org/docs/endians.html
00:06:10FromDiscord<nikki> for audio for the game i'm thinking about using soloud
00:06:16FromDiscord<nikki> mostly cuz i want it to work out of the box in emscripten too
00:06:24*sagax quit (Ping timeout: 260 seconds)
00:07:18FromGitter<jrfondren> CGI scripts, log mungers, some small UDP and TCP servers. nothing too big of a deal.
00:08:20FromDiscord<Gyllou> i might look at soloud, but even still the main dependencies are a TF type lib and deepspeech interface
00:08:41FromDiscord<Gyllou> though come to think of it i vaguely remember some deepspeech nim package, idk
00:09:39FromGitter<jrfondren> https://github.com/jrfondren/chrestomathy/tree/master/pwcheck is actually one of them
00:12:57FromDiscord<InventorMatt> Pmunch: what would I put for the other pointer? also while iterating through the tuple it gives me I am able to echo the values correctly and calling type on them works but any other function called on them and it points back to the tuple itself not the value
00:14:08PMunchHmm, do you have an example of your code?
00:15:28*astronavt quit (Remote host closed the connection)
00:16:00PMunchDepends on what you want for how to use endians
00:16:12*astronavt___ joined #nim
00:16:31PMunchHere's an example: https://play.nim-lang.org/#ix=2E4r
00:16:44FromDiscord<InventorMatt> yes, I do. i have the full everything in the github issue but here is the code https://play.nim-lang.org/#ix=2E4q
00:19:21PMunchAnd the problem is?
00:19:30PMunchHard to tell without knowing the content of that file
00:20:44FromDiscord<InventorMatt> https://figshare.com/articles/dataset/NEON_Teaching_Data_LiDAR_Point_Cloud_las_Data/4307750
00:20:49FromDiscord<InventorMatt> here is the file
00:21:06FromDiscord<InventorMatt> https://www.asprs.org/wp-content/uploads/2010/12/LAS_1_4_r13.pdf here is the spec
00:21:43FromDiscord<InventorMatt> the id parameter should be 101 but instead i am getting 25856
00:22:06PMunchYeah, that's big vs. little endian
00:22:39PMunchFrom that spec you linked: [A note on Bit Fields – The LAS storage format is “Little Endian.” This means that multi-byte data fields are stored in memory from least significant byte at the low address to most significant byte at the high address.
00:23:03mipri!eval echo (0x6500, 0x0065)
00:23:06NimBot(25856, 101)
00:23:07PMunchAnd binaryparse is Big Endian, meaning you need to swap the endianess of any field with more than one byte
00:23:40FromDiscord<InventorMatt> is there a way to change that for the parser or will just have to iterate through the result and do the swap there?
00:24:04PMunchYou just need to do it whenever you use the fields
00:24:17PMunchWell, you could define your own parser that does it automatically
00:25:46FromDiscord<InventorMatt> okay, thanks for the help.
00:25:52PMunchNo problem
00:26:19PMunchI was thinking of adding byte ordering to binaryparse, but I remember I had a reason that made me not do it..
00:26:48*astronavt___ is now known as astronavt
00:27:10FromDiscord<InventorMatt> so it won't be seen as a feature in the future then?
00:27:12FromDiscord<Avatarfighter> Yo yo yo everyone how is everyone 😄
00:27:12mipriyou thought that virtually all portable formats are big endian anyway?
00:27:13disruptekimproper byte ordering can yield indigestion; it was probably that.
00:27:37PMunchmipri, might've been :P
00:27:51PMunchBut I remember i wanted to add support for it
00:28:03miprithe swapEndian* API might also have been harder to apply than libc ntohs/ntohl functions
00:28:14PMunchThere is even procedures implemented for reading/writing the different endians
00:28:50PMunchInventorMatt, I might add it, but if you want to add it feel free :)
00:29:06PMunchI have no specific plans for adding it, but I agree that it would be useful
00:30:07FromDiscord<InventorMatt> i'll look through the code more and see how simply it could be done. it is a pretty dense macro in there so I don't know much i would want to mess with that
00:30:46PMunchHaha, yeah it's not the prettiest code..
00:31:25*astronavt quit (Remote host closed the connection)
00:32:41miprihttps://play.nim-lang.org/#ix=2E4u
00:32:45FromDiscord<InventorMatt> is it in the getinfo where the endianeness would be or could point me to the main proc for this part of it?
00:34:29PMunchOh wow, this is even worse than I remember..
00:35:42FromDiscord<VideoCarp> does Nim have any GUI packages other than IUP bindings?
00:36:13miprinimble search gui
00:36:43FromDiscord<VideoCarp> will try that
00:37:22PMunchInventorMatt, basically you want to add something to the format that allows you to specify endianess
00:37:41FromDiscord<VideoCarp> ah great thanks.↵is `nimble` basically the package manager?
00:37:46mipriyes
00:38:38mipriI haven't done any GUI stuff in Nim but looking around, nimqml looks interesting.
00:38:42PMunchThen you need to check info.size in createReadStatement and createWriteStatement and if it is a power of two and it was supposed to be the opposite endianess then use the other readData(LE|BE) function
00:38:54PMunchSome for writeData(LE|BE)
00:39:11PMunchwxnim also works fine @VideoCarp
00:39:20PMunchHas a neat little DSL as well
00:40:00miprithat's not in nimble search though :/
00:40:15FromDiscord<InventorMatt> I'll look into doing that and see what can be done, thank PMunch
00:40:56PMunchNo problem
00:41:35FromDiscord<shadow.> anyone know how to use winim?
00:41:46FromDiscord<shadow.> GetCursorPos is returning 0 every call
00:41:49PMunchHuh, I guess the original wxNim package might predate Nimble
00:41:51PMunchI'll add it
00:43:53FromDiscord<shadow.> nvm its bc i needed a POINT not an LPPOINT
00:47:34PMunchHmm, I'll add it tomorrow
00:47:37PMunchIt's getting late here
00:55:48FromDiscord<Daniel> sent a code paste, see https://play.nim-lang.org/#ix=2E4C
00:57:49miprihttps://nim-lang.org/docs/assertions.html#assert.t,untyped,string
00:59:12FromDiscord<Daniel> i already read that, however i am still at basics, did reach to templates yet
00:59:27miprithen what are you asking?
00:59:48FromDiscord<Daniel> because i dont understand the explanation written on that link
00:59:58mipriask a question about it, then
01:00:21FromDiscord<Daniel> what is assert used for?
01:00:47PMunchmipri, that was a discord bot code paste thing, it's a bit weird. But his question is in the "code"
01:00:49miprienforcing invariants in debugging or assertion builds.
01:01:23PMunchAssert will basically quit out of your program if the check is false
01:01:27miprihttps://www.sqlite.org/assert.html talks about assert in general
01:01:41PMunchAn easy way to make sure that some value is something while debugging
01:02:42PMunchAnd you will see it quite often in examples because it shows what value is expected, and with Nims ability to check code example from the documentation when it's generated it will make sure the documentation generation fails if something returns the wrong value.
01:02:48FromDiscord<Daniel> so basicaly its true/false checkpoint i guess
01:02:51miprithe idea is, when writing something you'll think, "this is only true if X is the case", and you'll promise yourself that you'll make X always the case. Maybe you still have to ensure that elsewhere. Maybe that's definitely the case right now but modifications to the code have to maintain it, so you write a comment to effect of "make sure X is the case!"
01:03:09mipriand writing an assertion when you have such thoughts is a way of actually ensuring that X is really the case
01:03:30FromDiscord<shadow.> !eval echo cast[string]([97.byte, 97.byte])
01:03:33NimBotTraceback (most recent call last)↵/usercode/in.nim(1) in↵SIGSEGV: Illegal storage access. (Attempt to read from nil?)
01:03:37FromDiscord<shadow.> f
01:03:54PMunchDaniel, yes pretty much
01:03:59mipriif it isn't, you have a bug, but because you made the assertion you have a quick failure at the point of X not being the case, rather than some potentially horrible behavior later on
01:04:02FromDiscord<shadow.> !eval var x: array[2, char] = [97, 97]; echo cast[string](x)
01:04:04NimBotCompile failed: /usercode/in.nim(1, 25) Error: type mismatch: got <array[0..1, int]> but expected 'array[0..1, char]'
01:04:05PMunchBut when compiling with -d:release they will be removed
01:04:24PMunchIf you need them in your release builds use `doAssert` instead
01:04:27FromDiscord<shadow.> !eval var x: array[2, char] = [97.chr, 97.chr]; echo cast[string](x)
01:04:29NimBot<no output>
01:04:32miprishadow., a string is structurally equivalent to a seq[char], so there's a header, it's not just a bare array
01:04:37FromDiscord<shadow.> ahh ok
01:04:49FromDiscord<shadow.> im tryna figure out how to send 2 uint16's as a packet string lol
01:04:54FromDiscord<shadow.> ill figure it out
01:05:08mipriwhat you might find more convenient is casting 0-terminating that and casting it to a cstring, and then .string'ing that
01:05:15FromDiscord<shadow.> hmm ok
01:05:33FromDiscord<shadow.> because right now im just sending an array[4, byte] through `net` but i wanna convert to `netty` which only supports strings iirc
01:05:36FromDiscord<shadow.> (edit) "iirc" => "afaik"
01:05:39PMunchUse binaryparse :)
01:05:44FromDiscord<shadow.> smart
01:06:12FromDiscord<Daniel> thank you guys, i understand much better now....i just wish documentation would have been written more noob friendly :)↵Luckily, you guys are here to help in non-programming terminology 👍
01:06:26FromDiscord<shadow.> can i parse a uint16 into a string with that lib lol (the sequence of bytes that make up that uint16)
01:06:31PMunchOh by the way InventorMatt, you can use `.read` instead of `[0]` to access the reader part of the parser tuple
01:07:00PMunchDepends on what you mean "as a string"
01:07:17PMunchDo you want "100,200" or do you want four characters parsed as a string?
01:07:24FromDiscord<shadow.> four characters parsed as string
01:07:29FromDiscord<shadow.> for instance
01:07:32FromDiscord<shadow.> if x is 1000
01:07:50FromDiscord<shadow.> then the string should be "bb"
01:07:51FromDiscord<shadow.> byte, byte
01:07:58FromDiscord<shadow.> since yk 2 bytes for a uint16
01:08:20PMunchHuh?
01:08:26FromDiscord<shadow.> and yeah so if its 400, 300 it should be a string of 4 chars
01:08:34mipri"since you need 2 bytes for a uint16"
01:08:52FromDiscord<shadow.> ye sorry
01:09:21PMunchI'm still not sure what you want your string to be
01:09:29FromDiscord<shadow.> lemme get an example
01:09:54FromDiscord<shadow.> !eval echo cast[array[2, byte]](1000)
01:09:57NimBot[232, 3]
01:10:03FromDiscord<shadow.> the string equivalent of that basically
01:10:21FromDiscord<shadow.> i was wondering how that would work tho since there isnt an encoding that has yk the full range of 1 byte values afaik
01:10:29PMunchSo chr(232) & chr(3)?
01:10:32FromDiscord<shadow.> ye basically
01:10:58PMunchYeah, that would be a `s: yourField[2]`
01:11:20PMunchs for string, yourField is the name of, well, your field, and [2] is to read two bytes.
01:11:28Zoom[m]Eh, can you iterate over table's values with iterutils?
01:11:31FromDiscord<shadow.> hmm ok thanks lemme try that
01:11:47Zoom[m]foldl for example
01:11:56PMunchZoom[m], what's wrong with `for x in myTable.values`?
01:12:09PMunchOh
01:12:47PMunchI think you should be able to
01:13:13FromDiscord<shadow.> so if i have variable x which is equal to 1000, how do i get the string value? sorry
01:13:14Zoom[m]Nothing, it's just nice to read
01:13:24FromDiscord<shadow.> im a bit confused by the macro lol
01:13:40PMunchOh you just have a single variable?
01:13:59FromDiscord<shadow.> well i have x and y sorry
01:14:04FromDiscord<shadow.> basically im encoding mouse x and y into a string packet lmao
01:14:13FromDiscord<shadow.> (edit) "basically im encoding mouse ... x" added "position"
01:14:15PMunchI thought you wanted to read this out of or into some binary format
01:14:27FromDiscord<shadow.> well i need to convert the two uint16's into a string form
01:14:31FromDiscord<shadow.> in binary yeah
01:14:36FromDiscord<shadow.> not in text form
01:14:51FromDiscord<shadow.> like you said before, [chr(232), chr(3)]
01:14:57FromDiscord<shadow.> rather than "1000"
01:15:14PMunchI mean you could do `cast[cstring](cast[array[4, char](x.uint32 shl 1)[1..^1])`
01:15:18PMunchOr something like that
01:15:28FromDiscord<shadow.> ahh thats what i was doing before lol
01:15:32FromDiscord<shadow.> except for the cstring part
01:15:33FromDiscord<shadow.> thanks
01:16:19FromDiscord<nikki> you might want to explicitly take the bytes out bc endiannness stuff
01:16:25Zoom[m]PMunch i get `undeclared field: 'values'` when I pass it to foldl. `1..10` in it's place works
01:16:25FromDiscord<shadow.> hm
01:16:29FromDiscord<shadow.> well the way i was going to do it was like
01:16:38FromDiscord<shadow.> "xxyy"
01:16:42FromDiscord<nikki> could look at what frosty does
01:16:43FromDiscord<shadow.> x being an x byte and y being a y byte
01:16:58Zoom[m] * PMunch i get `undeclared field: 'values'` when I pass it to foldl. `1..10` in its place works
01:17:22FromDiscord<nikki> yeah values is an iterator
01:17:32FromDiscord<nikki> can we see the whole code
01:17:36FromDiscord<nikki> for this foldl thing
01:18:41FromDiscord<nikki> why not just write a bunch of for loops 😄
01:18:43mipriseems like a gap for iterutils to not be able to iterate over an iterator
01:19:16Zoom[m]In deed :D
01:19:30mipribut toSeq(xs.values).map(...) works
01:20:21FromDiscord<nikki> yea this is why i prefer for loops
01:20:32FromDiscord<nikki> no need to make intermediate seqs
01:20:53FromDiscord<nikki> iterators are not first class values they are kinda macros to generate loop code
01:21:00FromDiscord<nikki> closure iterators are more like that tho
01:21:32PMunchYeah that's a bit weird
01:21:38Zoom[m]Yeah, it kind of defeats the purpose. Too bad they're not first class
01:23:31Zoom[m]Let me see what zero_functional offers
01:25:05FromDiscord<shadow.> how do you concatenate c strings?
01:25:44PMunchBy turning them into strings
01:25:55PMunchZoom[m], you can do this: https://play.nim-lang.org/#ix=2E4K
01:25:57FromDiscord<shadow.> smart
01:26:24FromDiscord<nikki> @shadow. i feel like you should have a buffer somewhere and just keep writing bytes to it
01:26:29PMunchBut I feel you're doing something wrong @shadow :P
01:26:37mipriincidentally Kotlin made a similar choice to Nim's iterators (vs. C++/D/Rust iterators) with https://kotlinlang.org/docs/reference/inline-functions.html
01:27:07PMunchI think there is a PR or a thing in devel that allows you to use iterators like this
01:27:09PMunchIIRC
01:27:19FromDiscord<shadow.> i just wish the netty package supported array[byte] lol
01:27:25FromDiscord<shadow.> but i have to send strings
01:27:32FromDiscord<shadow.> i suppose i could look at the source
01:27:49FromDiscord<shadow.> i mean technically all i need is a way to convert an array[4, byte] to a string of 4 chars
01:28:03Zoom[m]Yay, zero_functional worked on a CountTable
01:28:04FromDiscord<nikki> yeah i just think iterator composition on data strctures is meh
01:28:17FromDiscord<nikki> seems fine ish on stream style things
01:28:26FromDiscord<nikki> nice
01:28:55FromDiscord<nikki> @shadow. wait it really only supports sending strings?
01:29:03FromDiscord<nikki> of binary data
01:29:06mipriwell in a pinch, newString() and then copyMem(mystr[0].addr, myarray[0].addr)
01:29:13*abm quit (Read error: Connection reset by peer)
01:29:22FromDiscord<nikki> after resizing the string
01:29:45FromDiscord<nikki> but yeah if you setLen it to be big enough, that works
01:29:50PMunchCreate a stringStream and use binaryparse to put your data in it
01:30:11FromDiscord<nikki> i think it's good to just use the string as the buffer at that point yeah
01:30:26FromDiscord<shadow.> alright fair enough
01:30:31FromDiscord<shadow.> and yeah it only supports strings from what i can tell
01:32:36miprihttps://play.nim-lang.org/#ix=2E4L
01:32:48Zoom[m]PMunch: thanks, will look into Nim closures
01:33:36FromDiscord<nikki> yea "first class symbols" or sth
01:33:43FromDiscord<nikki> @shadow. https://media.discordapp.net/attachments/371759389889003532/776983160751783956/image0.png
01:33:46FromDiscord<nikki> sorry for image lol am on mobile
01:33:50FromDiscord<nikki> but found this in netty code
01:34:09FromDiscord<nikki> you can probs do sth similar
01:34:16FromDiscord<nikki> make string of cap, add stuff, send
01:34:35PMunchOr, you know, just use binaryparse and a string stream :P
01:34:40PMunchAnyways, I'm off to bed
01:34:47FromDiscord<shadow.> rip
01:34:51FromDiscord<shadow.> cya thx for the help
01:34:54FromDiscord<shadow.> copymem seemed to work
01:34:55PMunchNo problem
01:34:57*PMunch quit (Quit: leaving)
01:35:05FromDiscord<shadow.> ill do binaryparse soon once i yk
01:35:07FromDiscord<shadow.> figure it out
01:35:07FromDiscord<shadow.> lol
01:37:20FromDiscord<shadow.> ah well treeform is on this server
01:37:25FromDiscord<shadow.> so if he ever swings around i could ask him lol
01:39:48FromDiscord<shadow.> nvm figured out the issue lo
01:39:49FromDiscord<shadow.> (edit) "lo" => "lol"
01:43:06FromDiscord<Rika> Closure iterators are kinda slow and it’s sad, I think they’re great
01:43:14FromDiscord<shadow.> !eval echo sizeof(int)
01:43:17NimBot8
01:43:26FromDiscord<shadow.> oop yike
01:44:34FromGitter<gogolxdong> could iterator be recursive?
01:47:41FromDiscord<shadow.> !eval echo cast[cstring](1000)
01:47:44NimBotCompile failed: Error: unhandled exception: value out of range: 1000 notin 0 .. 255 [RangeDefect]
01:47:50FromDiscord<shadow.> lol fair enough
01:48:10FromDiscord<shadow.> !eval echo $(cast[cstring](cast[array[2, byte]](1000)))
01:48:13NimBot<no output>
01:48:20FromDiscord<shadow.> ah right
01:50:30*pbb quit (Read error: Connection reset by peer)
01:50:59*pbb joined #nim
02:02:20FromDiscord<shadow.> @nikki i wound up just abusing the fuck out of copyMem
02:02:34FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2E4T
02:02:49FromDiscord<shadow.> (edit) "https://play.nim-lang.org/#ix=2E4T" => "https://play.nim-lang.org/#ix=2E4U"
02:02:53FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2E4V
02:06:27FromDiscord<nikki> u can use sizeof instead of writing 4 everywhere
02:13:13*apahl_ joined #nim
02:16:16*apahl quit (Ping timeout: 258 seconds)
02:17:00FromDiscord<shadow.> smart
02:17:39*kinkinkijkin joined #nim
02:18:26FromGitter<gogolxdong> !eval echo (if true: 1 else:0)
02:18:29NimBot1
02:19:16FromDiscord<shadow.> smart
02:19:23disruptekwhy would i want to write `sizeof` when i can just write `4`?
02:20:01FromDiscord<shadow.> or even better, just replace 4 with \` and make a compile-time script to replace all the \` with 4's
02:20:13FromDiscord<shadow.> much easier to reach that key than 4
02:22:55disruptek~&
02:22:55disbot&: 11unreachable
02:26:23FromDiscord<shadow.> !eval echo (let x = (let y = (let z = 0; z); y); x)
02:26:26NimBot0
02:26:42FromDiscord<shadow.> brb making a macro to do that for every assignment
02:27:40mipriif you want to initialize a bunch of variables to the zero or the same thing, there's respectively
02:27:48mipri!eval var x, y, z; echo (x, y, z)
02:27:50NimBotCompile failed: /usercode/in.nim(1, 12) Error: ':' or '=' expected, but got ';'
02:27:54FromDiscord<shadow.> nah it was sarcastic lol
02:27:55mipri!eval var x, y, z: int; echo (x, y, z)
02:27:58NimBot(0, 0, 0)
02:28:05FromDiscord<shadow.> im just saying it was an overly complicated way of getting a value
02:28:07mipri!eval var x, y, z = 2; echo (x, y, z)
02:28:08FromDiscord<shadow.> satire
02:28:10NimBot(2, 2, 2)
02:28:41mipriin general, an expression = would conflict with Nim's syntax for named parameters
02:28:42disruptekthere's nothing funny about trip dueces.
02:28:48FromDiscord<shadow.> for instance macro would replace↵`let num = 10`↵with↵`let num = (let x = (let y = (let z = 10; z); y); x)`
02:28:56FromDiscord<shadow.> rip
02:29:03*xet7 quit (Quit: Leaving)
02:30:44*xet7 joined #nim
02:45:13FromDiscord<shadow.> !eval echo false.int
02:45:16NimBot0
02:48:55mipri!eval ["yes", "no"][int(7 > 3)]
02:48:57NimBotCompile failed: /usercode/in.nim(1, 14) Error: expression '["yes", "no"][int:
02:49:03mipri!eval echo ["yes", "no"][int(7 > 3)]
02:49:05NimBotno
02:49:32FromDiscord<shadow.> !eval if 0: echo "hi" elif 1: echo "hello"
02:49:33NimBotCompile failed: /usercode/in.nim(1, 4) Error: type mismatch: got <int literal(0)> but expected 'bool'
02:49:40FromDiscord<shadow.> (edit) ""hi"" => ""hi";"
02:49:44FromDiscord<shadow.> ah right .bool
02:51:22mipri!eval echo (0.bool, 1.bool, 2.bool)
02:51:25NimBot(false, true, true)
02:52:19FromDiscord<demotomohiro> !eval echo 0.0.bool, "".bool, nil.bool
02:52:22NimBotCompile failed: /usercode/in.nim(1, 18) Error: type mismatch: got <string> but expected 'bool'
02:53:18FromDiscord<ElegantBeef> there is a lot wrong with above
02:53:50miprimaybe above isn't too fond of you. did you consider that?
02:54:24FromDiscord<ElegantBeef> Well i know they arent, it's me after all
03:03:52FromDiscord<nikki> !echo 0xbeef
03:03:59FromDiscord<nikki> lol i'm silly
03:04:08FromDiscord<nikki> !eval echo 0xbeef
03:04:10FromDiscord<ElegantBeef> Yea your forget `!eval
03:04:11NimBot48879
03:04:53FromDiscord<ElegantBeef> !eval echo 0xe1e9a47beef
03:04:56NimBot15524600200943
03:07:35FromDiscord<nikki> !eval echo "hello @", "ElegantBeef"
03:07:37NimBothello @ElegantBeef
03:07:44FromDiscord<ElegantBeef> Lol
03:07:53FromDiscord<ElegantBeef> Fucking nim bot
03:09:06FromDiscord<nikki> !eval echo "/tableflip"
03:09:08NimBot/tableflip
03:09:28FromDiscord<nikki> (╯°□°)╯︵ ┻━┻
03:15:41FromDiscord<Rika> That’s a discord client thing
03:16:16FromDiscord<nikki> yee
03:16:26FromDiscord<nikki> i wanted to see if @blah would just get interpreted tho
03:16:30FromDiscord<nikki> and it did which was nice
03:16:48FromDiscord<Rika> !eval echo "haha pinged you @","nikki"
03:16:50NimBothaha pinged you @nikki
03:16:58FromDiscord<Rika> LOL who is that
03:17:15FromDiscord<nikki> lmao. also i just did the same thing above with beef if u can see it
03:17:23FromDiscord<Rika> Ok
03:17:49disruptekthe bridge lets the bot ping you?
03:17:58FromDiscord<Rika> Yes
03:18:09FromDiscord<Rika> And it’s pretty broken still
03:18:26disruptekwanna fix it for me?
03:18:41disrupteki am waiting for someone to impl my requested feature.
03:20:03disruptekrika: do you remember how to code?
03:20:22FromDiscord<Rika> I hope I do
03:20:46FromDiscord<Rika> I’d fix it if I were motivated enough, might be tomorrow, I’ll take a look then
03:21:15disrupteki just want a way for my bot to send privmsg through the bridge.
03:22:55FromDiscord<Rika> Ooh that’s a bit hard, also people can disable dm from bots in discord
03:23:10disruptekthat's their problem.
03:23:23FromDiscord<Rika> Okay
03:23:40FromDiscord<Rika> I’ll look into it tomorrow, not like I have anything to do during this damn quarantine
03:23:42FromDiscord<nikki> @Rika did u impl the bridge
03:23:43disruptekit's just annoying that people cannot !help and get help.
03:23:46FromDiscord<Rika> No
03:23:51FromDiscord<Rika> That’s Yardanico
03:24:37disrupteki've seen the code. i'm not going near it.
03:25:05*astronavt joined #nim
03:34:59FromDiscord<demotomohiro> !eval echo ((1.0 + 1.0e-15 - 1.0).bool, (1.0 + 1.0e-16 - 1.0).bool, (1.0 + 1.0e-17 - 1.0).bool, ) ↵!eval echo ((1.0e-15 - 1.0 + 1.0).bool, (1.0e-16 - 1.0 + 1.0).bool, (1.0e-17 - 1.0 + 1.0).bool, )↵!eval echo ((0.5 + 1.0e-15 - 0.5).bool, (0.5 + 1.0e-16 - 0.5).bool, (0.5 + 1.0e-17 - 0.5).bool, )
03:35:01NimBotCompile failed: /usercode/in.nim(1, 96) Error: undeclared identifier: '!'
03:36:57FromDiscord<demotomohiro> !eval echo ((1.0 + 1.0e-15 - 1.0).bool, (1.0 + 1.0e-16 - 1.0).bool, (1.0 + 1.0e-17 - 1.0).bool, )↵echo ((1.0e-15 - 1.0 + 1.0).bool, (1.0e-16 - 1.0 + 1.0).bool, (1.0e-17 - 1.0 + 1.0).bool, )↵echo ((0.5 + 1.0e-15 - 0.5).bool, (0.5 + 1.0e-16 - 0.5).bool, (0.5 + 1.0e-17 - 0.5).bool, )
03:36:59NimBotCompile failed: /usercode/in.nim(1, 92) Error: undeclared identifier: '↵echo'
03:38:21PrestigeAnyone know what the int index here is supposed to be? https://tronche.com/gui/x/xlib/utilities/keyboard/XLookupKeysym.html
03:42:45FromDiscord<shadow.> > Specifies the index into the KeySyms list for the event's KeyCode
03:42:56FromDiscord<shadow.> that doesnt mean anything to you im guessing?
03:43:00FromDiscord<ElegantBeef> Welcome to X where that means nothing 😄
03:43:20FromDiscord<shadow.> rip
03:44:00FromDiscord<ElegantBeef> I could be wrong prestige but 0 might mean xkeypresedevent and 1 means releasedevent
03:44:31Prestigewell, the issue is that multiple keys (like 1 and !) share the same keycode
03:44:54Prestigeso the col/index might determine which... I'm not sure
03:44:56FromDiscord<demotomohiro> https://tronche.com/gui/x/xlib/input/keyboard-encoding.html↵I duckduckgo "xlib keysym" and it seems explaining about keysym
03:44:58FromDiscord<ElegantBeef> Yea the mod mask is different for them
03:45:04FromDiscord<shadow.> !eval var x = [232.byte, 3.byte, 232.byte, 3.byte]; var y: array[2, uint16]; memCopy(y[0].addr, x[0].addr, sizeof(x)); echo y
03:45:07NimBotCompile failed: /usercode/in.nim(1, 72) Error: undeclared identifier: 'memCopy'
03:45:13FromDiscord<shadow.> shoot
03:45:23FromDiscord<ElegantBeef> shadow do you need to `nimble install inim`?
03:45:26Prestigethe keysym is different
03:45:46FromDiscord<shadow.> is memCopy not on the playground
03:45:51mipriit's copyMem
03:46:52FromDiscord<ElegantBeef> Speaks like yoda shadow
03:47:29mipriit's not a mem kinda copy, it's a proc that copies memory
03:48:07FromDiscord<ElegantBeef> well it'd just be copy if it was a mem type of copy
03:48:21FromDiscord<shadow.> im dumb
03:48:31FromDiscord<shadow.> !eval var x = [232.byte, 3.byte, 232.byte, 3.byte]; var y: array[2, uint16]; copyMem(y[0].addr, x[0].addr, sizeof(x)); echo y
03:48:34NimBot[1000, 1000]
03:48:43FromDiscord<shadow.> THAT WORKS?
03:48:47FromDiscord<ElegantBeef> Also this isnt "the playground"
03:48:51FromDiscord<shadow.> lol
03:48:55FromDiscord<shadow.> eval bot
03:49:10disruptekdisbot: ignore shadow.
03:49:10disboton it. 👍
03:49:19FromDiscord<shadow.> wow
03:49:23FromDiscord<shadow.> :c
03:49:35FromDiscord<shadow.> sad
03:49:37FromDiscord<ElegantBeef> Selectively ignored, see that's what you get
03:49:48FromDiscord<shadow.> for doing what
03:49:51FromDiscord<ElegantBeef> Just remember the eval bot isnt ignored afaik
03:49:56FromDiscord<ElegantBeef> So you can still pester him
03:50:00FromDiscord<shadow.> huh
03:50:07FromDiscord<ElegantBeef> I clearly joke
03:50:10FromDiscord<shadow.> im confused why was i just ignored
03:50:54FromDiscord<shadow.> did i do something wrong lmao
03:50:59FromDiscord<ElegantBeef> Probably due to the abuse of the eval bot
03:51:11FromDiscord<shadow.> wait are we not suppose to use it like that
03:51:31FromDiscord<shadow.> shit my bad
03:52:40FromDiscord<shadow.> my apologies
03:55:57*muffindrake quit (Ping timeout: 260 seconds)
03:56:07ForumUpdaterBotNew thread by Stbalbach: Creating unique ID from strings, see https://forum.nim-lang.org/t/7088
03:57:12FromDiscord<shadow.> so can i not use eval bot now 💀
03:57:16FromDiscord<shadow.> rip
03:57:25FromDiscord<ElegantBeef> I have no idea
03:57:52FromDiscord<Rika> disbot is not nimbot lol
03:57:55*muffindrake joined #nim
03:58:00FromDiscord<shadow.> oh lmao
03:58:12FromDiscord<Rika> anyway still use the playground please
03:58:12FromDiscord<ElegantBeef> I forget which is which
03:58:18FromDiscord<shadow.> kk i will
03:58:18FromDiscord<ElegantBeef> Or inim
03:58:25FromDiscord<shadow.> what does disbot even do lol
03:58:30FromDiscord<Rika> idk
03:58:31FromDiscord<ElegantBeef> !repo nimscripter
03:58:32disbothttps://github.com/beef331/nimscripter -- 9nimscripter: 11Quick and easy Nim <-> Nimscript interop 15 10⭐ 0🍴
03:58:38FromDiscord<Rika> ah yeah that
03:58:39FromDiscord<shadow.> woa
03:59:26FromDiscord<shadow.> i believe i mighta asked this a while ago but i forget, has an interactive shell type thing been made for nim yet?
03:59:34FromDiscord<ElegantBeef> if i say inim
03:59:39FromDiscord<ElegantBeef> And you dont `nimble install inim`
03:59:42FromDiscord<ElegantBeef> it's your own fault
03:59:46FromDiscord<shadow.> ah so thats what that is LOL
03:59:49FromDiscord<shadow.> ty
03:59:57FromDiscord<shadow.> where can i read docs?
04:00:17FromDiscord<ElegantBeef> !repo inim
04:00:18disbothttps://github.com/inim-repl/INim -- 9INim: 11Interactive Nim Shell / REPL / Playground 15 371⭐ 18🍴
04:00:23FromDiscord<shadow.> ty
04:01:27FromDiscord<shadow.> damn that is very sick
04:06:02*supakeen quit (Quit: WeeChat 2.9)
04:06:35*supakeen joined #nim
04:11:06*sagax joined #nim
04:32:57*ForumUpdaterBot quit (Remote host closed the connection)
04:32:57*Yardanico quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
04:33:16*Yardanico joined #nim
04:45:43FromDiscord<Daniel> can anyone help me to determine why am i getting an error here: https://media.discordapp.net/attachments/371759389889003532/777031483696611348/unknown.png
04:46:47FromDiscord<Daniel> i have been bulging my eyes into this for last 20minutes, but just cant notice what i did wrong 🤔
04:47:05*apahl_ quit (Ping timeout: 272 seconds)
04:47:14FromDiscord<Daniel> i should be in bed sleeping, fml
04:47:35disruptekcould be that the newline characters don't match.
04:47:35disruptekecho expected
04:47:35disruptekthat's \c\l not \c\1, right?
04:47:47*apahl joined #nim
04:49:01FromDiscord<Daniel> sent a code paste, see https://play.nim-lang.org/#ix=2E5g
04:49:06FromDiscord<Rika> why \c\1?
04:49:34FromDiscord<Daniel> for carriage return
04:50:56FromDiscord<Rika> carriage return uses \1? [SOH Start of Heading]?
04:51:15FromDiscord<Rika> thats a one, not an L
04:52:03FromDiscord<ElegantBeef> https://nim-lang.org/docs/manual.html#lexical-analysis-string-literals
04:52:28FromDiscord<Rika> you prolly mean l yeah
04:52:36FromDiscord<Rika> `\c\l` and not `\c\1`
04:53:35FromDiscord<Daniel> i am following this to learn:↵https://livebook.manning.com/book/nim-in-action/chapter-3/240
04:53:51FromDiscord<ElegantBeef> yea
04:53:54FromDiscord<Daniel> but now i am stuck, i better go to bed and sleep over it
04:53:59FromDiscord<ElegantBeef> they use `\c\l`
04:54:03FromDiscord<ElegantBeef> as in L not 1
04:54:21FromDiscord<ElegantBeef> https://media.discordapp.net/attachments/371759389889003532/777033654828400640/unknown.png
04:54:30FromDiscord<Daniel> omg, i see what you meen, small case letter L
04:54:37FromDiscord<Rika> yeah and you put 1
04:54:54FromDiscord<Daniel> yea, i used a number, ....this rly means i need some sleep, lol
04:54:56FromDiscord<Daniel> thank you guys
04:57:38*astronavt quit (Quit: Leaving)
05:00:42FromDiscord<VideoCarp> why am I getting invalid indentation here? it looks fully consistent, all of them are using the same amount of spaces, 4.↵location: 23,51↵<https://play.nim-lang.org/#ix=2E5h>
05:01:43disruptekyour tuples need to be in ()
05:01:56disruptekyou cannot destructure `1, 2`.
05:02:31FromDiscord<VideoCarp> ah so it isn’t indentation
05:02:46disruptekit's a message from the parser.
05:04:51FromDiscord<VideoCarp> now it’s doing all of the conditions whether failed or not
05:06:16disruptektry `for cond in conditions: ... for action in dostuff: ...`
05:06:51disrupteki personally use items() and pairs() explicitly, but i'm in the minority.
05:07:25FromDiscord<Daniel> i got the error again https://media.discordapp.net/attachments/371759389889003532/777036942473822248/unknown.png
05:07:32FromDiscord<Daniel> but i found it accidentaly
05:07:39FromDiscord<Daniel> it was this space before hello
05:07:49FromDiscord<Daniel> i thought space would be ignored inside
05:07:59disrupteknah. it's a string.
05:08:07FromDiscord<VideoCarp> never knew the `for` can be done like python, but it had the same problem, doing all of them.
05:08:34FromDiscord<Daniel> yea its a string, but isnt only stuff in quotes analysed?
05:08:37disruptekecho your unit.
05:08:52disruptekdaniel: it's in quotes. it's triple-quoted, in fact.
05:09:20FromDiscord<Daniel> is it because of triple quotes then?
05:10:07FromDiscord<nikki> it's because the json output you're checking against doesn't have the space
05:10:30FromDiscord<VideoCarp> when using `h`, it results in `hhhhhhhhhhhhh` with newlines separating each character.↵so it’s getting the right input.
05:10:32disruptektriple-quotes are syntax for strings.
05:11:33FromDiscord<Daniel> righto, thank you, going to bed, my brain is soup, gn
05:11:40FromDiscord<VideoCarp> i think they’re multiline strings
05:12:16FromDiscord<Rika> they are
05:16:29*ForumUpdaterBot joined #nim
06:21:52*xet7 quit (Quit: Leaving)
06:23:20*xet7 joined #nim
06:38:48*mmohammadi9812 joined #nim
06:45:13*waleee-cl quit (Quit: Connection closed for inactivity)
06:48:05*thomasross quit (Quit: Leaving)
06:54:47*a_chou joined #nim
06:56:08*a_chou quit (Remote host closed the connection)
07:00:30*habamax joined #nim
07:19:43*solitudesf joined #nim
07:50:07*narimiran joined #nim
07:55:42*mmohammadi9812 quit (Ping timeout: 260 seconds)
07:56:09*mmohammadi9812 joined #nim
07:57:52*narimiran quit (Ping timeout: 246 seconds)
08:00:16*narimiran joined #nim
08:20:41*Vladar joined #nim
08:22:45*bung joined #nim
08:28:11bunghttps://github.com/nim-lang/Nim/pull/15933 merge this please
08:28:11disbotadd testcase for #15937
08:57:31*narimiran quit (Ping timeout: 265 seconds)
09:16:11bungis there a way avoiding duplicated "template/generic instantiation of " messages ?
09:16:54ForumUpdaterBotNew thread by Elcritch: Possible usage of Nim & Z3 for embedded?, see https://forum.nim-lang.org/t/7089
09:38:51*gangstacat quit (Quit: Ĝis!)
09:40:57ForumUpdaterBotNew thread by Yglukhov: Tweaking optimizations for dependencies, see https://forum.nim-lang.org/t/7090
09:44:43*natrys joined #nim
10:03:00*hnOsmium0001 quit (Quit: Connection closed for inactivity)
10:25:06*bung quit (Ping timeout: 256 seconds)
10:26:01*bung joined #nim
10:36:40FromDiscord<lqdev> @Daniel btw you probably want to be using \p instead of \c\l
10:36:57FromDiscord<lqdev> \p is the platform specific newline escape sequence
10:37:18FromDiscord<lqdev> so \c\l on windows, \l on unix
11:10:04*Vladar quit (Quit: Leaving)
11:27:58*Vladar joined #nim
12:06:01*supakeen quit (Quit: WeeChat 2.9)
12:06:34*supakeen joined #nim
12:09:22ForumUpdaterBotNew thread by Enthus1ast: Muk - a crossplattform terminal music and video player., see https://forum.nim-lang.org/t/7091
12:19:24*lritter joined #nim
12:30:02FromDiscord<alehander42> ok
12:32:24*weeqw joined #nim
12:50:55*haxscramper joined #nim
12:52:04Zevvhttps://pwlconf.org/2019/shriram-krishnamurthi/
12:57:30*Vladar quit (Quit: Leaving)
12:57:33disruptekoh yeah?
12:57:40haxscramperIs there any way to use block call syntax to pass to a particular argument of a template? I have `mapIt`-like template with 4 arguments, where `body` must be last, but I want to have some default values for arguments.
12:58:02haxscramperI tried with `do:` but it didn't work
12:58:42disruptekmake more templates that forge the default values.
13:01:10*gangstacat joined #nim
13:04:15Zevvdisruptek: if you can spare the bandwith, the guy make sense
13:04:57disrupteklemme make some coffee and rub one out.
13:19:29ForumUpdaterBotNew thread by Peter: Kill thread?, see https://forum.nim-lang.org/t/7092
13:21:01*PMunch joined #nim
13:34:49*habamax quit (*.net *.split)
13:34:50*Kaivo quit (*.net *.split)
13:34:50*vesper11 quit (*.net *.split)
13:34:50*jxy quit (*.net *.split)
13:35:50*Kaivo joined #nim
13:35:52*jxy joined #nim
13:37:43*MTRNord[m] quit (*.net *.split)
13:37:43*hnOsmium0001[m] quit (*.net *.split)
13:37:43*jonjitsu[m] quit (*.net *.split)
13:37:43*npgm_ quit (*.net *.split)
13:37:43*kwilczynski quit (*.net *.split)
13:37:43*matlock quit (*.net *.split)
13:37:43*ehmry quit (*.net *.split)
13:37:43*lum quit (*.net *.split)
13:37:43*koltrast quit (*.net *.split)
13:37:43*Northstrider[m] quit (*.net *.split)
13:40:58*MTRNord[m] joined #nim
13:40:58*hnOsmium0001[m] joined #nim
13:40:58*jonjitsu[m] joined #nim
13:40:58*npgm_ joined #nim
13:40:58*kwilczynski joined #nim
13:40:58*matlock joined #nim
13:40:58*ehmry joined #nim
13:40:58*lum joined #nim
13:40:58*koltrast joined #nim
13:40:58*Northstrider[m] joined #nim
13:41:09*habamax joined #nim
13:41:21*hnOsmium0001[m] quit (Max SendQ exceeded)
13:43:36*kwilczynski quit (Ping timeout: 246 seconds)
13:44:18*jonjitsu[m] quit (Ping timeout: 246 seconds)
13:44:25*Avatarfighter[m] quit (Ping timeout: 240 seconds)
13:44:25*jrhawley[m] quit (Ping timeout: 240 seconds)
13:44:26*brainbomb[m] quit (Ping timeout: 240 seconds)
13:44:26*Zoom[m] quit (Ping timeout: 240 seconds)
13:44:27*nikki93[m] quit (Ping timeout: 240 seconds)
13:44:32*Helios quit (Ping timeout: 260 seconds)
13:44:37*ee7[m] quit (Ping timeout: 244 seconds)
13:44:37*lnxw37d4 quit (Ping timeout: 244 seconds)
13:44:37*guelosk[m] quit (Ping timeout: 244 seconds)
13:44:38*planetis[m] quit (Ping timeout: 244 seconds)
13:44:38*Jitty[m] quit (Ping timeout: 244 seconds)
13:44:39*unclechu quit (Ping timeout: 246 seconds)
13:44:41*leorize[m]1 quit (Ping timeout: 244 seconds)
13:44:41*BitPuffin quit (Ping timeout: 244 seconds)
13:44:41*reversem3 quit (Ping timeout: 244 seconds)
13:44:41*lum[m] quit (Ping timeout: 244 seconds)
13:44:56*ache-of-head[m] quit (Ping timeout: 268 seconds)
13:44:56*leorize[m] quit (Ping timeout: 268 seconds)
13:46:21*kwilczynski joined #nim
13:48:08*MTRNord[m] quit (Ping timeout: 246 seconds)
13:50:26*muffindrake quit (Ping timeout: 264 seconds)
13:52:14*muffindrake joined #nim
13:56:49*superbia joined #nim
13:57:11*bung quit (Quit: Lost terminal)
14:00:25*weeqw quit (Read error: Connection reset by peer)
14:05:25*objQ joined #nim
14:06:34objQHey, dumb question, what is the purpose of the * when defining an object? The Nim by Example tutorial gives the example "type Animal* = object"
14:06:51*jonjitsu[m] joined #nim
14:09:49supakeenIt means it's exported.
14:10:08*BitPuffin joined #nim
14:10:14*planetis[m] joined #nim
14:10:40objQIs that just for objects or for functions as well? I
14:11:24supakeenBoth.
14:11:49objQCool, thank you.
14:11:55*unclechu joined #nim
14:11:56supakeenobjQ: https://nim-lang.org/docs/manual.html#procedures-export-marker see there :)
14:12:42objQWhat happens if you don't use an asterisk on one of the fields of an exported object?
14:13:52solitudesfit wont be exported
14:15:01*brainbomb[m] joined #nim
14:15:44*reversem3 joined #nim
14:15:47*nikki93[m] joined #nim
14:15:48*lum[m] joined #nim
14:15:56*lnxw37d4 joined #nim
14:16:31*leorize[m]1 joined #nim
14:16:53*ee7[m] joined #nim
14:17:13objQAre there any libraries or packages I can look at to get a sense of how Nim codebases are supposed to be formatted? I've read the style guide but it's pretty short and doesn't really speak to larger scale format.
14:17:22*jrhawley[m] joined #nim
14:17:24*Zoom[m] joined #nim
14:17:24*Avatarfighter[m] joined #nim
14:17:47*Jitty[m] joined #nim
14:17:48*guelosk[m] joined #nim
14:18:06*Helios joined #nim
14:18:18*leorize[m] joined #nim
14:18:26*ache-of-head[m] joined #nim
14:24:05*habamax quit (Quit: leaving)
14:24:22*habamax joined #nim
14:24:47*objQ quit (Remote host closed the connection)
14:25:27supakeenYou can take a look at some of the codebases around such as npeg, etc but I don't know if there's really any 'standard of formatting' :)
14:25:36FromDiscord<haxscramper> Can read stdlib implementation. But there is no difference really between large and small-scale format
14:26:15disruptekeverything i've ever written is perfect.
14:26:18FromDiscord<haxscramper> Most code I've seen formatted like stdlib (`camelCase`, 2 spaces indentation and that's about it)
14:30:43*hnOsmium0001[m] joined #nim
14:30:44Zevvyeah npeg is the new standard
14:30:45Zevvsure
14:31:26disruptekhonestly, compiler style is really the only gate i can think of.
14:32:44*evilkhaoskat joined #nim
14:34:23*MTRNord[m] joined #nim
14:34:36disruptek1) `for t in items tees:` or 2) `for t in tees.items:` or 3) `for t in tees:`... vote.
14:36:07*waleee-cl joined #nim
14:41:20FromDiscord<Rika> id do 3
14:44:26disrupteki've been experimenting with 1 but i think i'm going back to 2.
14:45:59FromDiscord<Rika> 1 looks really weird to me
14:46:04FromDiscord<Rika> i do 2 sometimes
14:46:55disruptekthe goal is to remove implicit items/pairs, and being more explicit is, to me, a win.
14:47:19disruptekie. nim-2 probably won't do implicit items/pairs.
15:01:03FromDiscord<dom96> `for t in items(tees)` is the winner
15:01:38disruptekthe problem with it is that the piece of info you want to convey earliest, that is most important for comprehension, is `tees`.
15:02:22disruptek"in items" becomes noise.
15:03:32disruptek.items can be thought of as conversion, which maybe makes it easier to accept.
15:06:35Zevvi always 3. I like terse. Its not like it's ambigious
15:07:40disrupteki didn't get that talk.
15:08:21disruptekcould be that i just take the theorems for granted, though.
15:09:42disruptekbut i definitely sympathize with the introduction of expression as a can-o-worms that i don't always want to unpack; timmy tends to aggravate these things.
15:13:13disruptekZevv: this is why the `return in expr` is so disturbing to me.
15:13:58*natrys quit (Ping timeout: 246 seconds)
15:14:09supakeeni like doms
15:15:34FromDiscord<haxscramper> `3` might suffer from some generic issues - e.g. you can't easily (AFAIK) mixin implicit `items`
15:17:46disrupteknot sure what you mean.
15:18:16disruptekthe omission of the iterator is, afaik, sugar.
15:22:48FromDiscord<haxscramper> sent a code paste, see https://paste.rs/1MV
15:23:01FromDiscord<haxscramper> If I add `items` to `difference` implementation it works
15:24:16FromDiscord<haxscramper> Something like that. But this has issue already AFAIC, I just don't remember which one
15:24:35disruptekhuh. i don't use mixin.
15:24:47disruptekcan't remember if it's because of this, though.
15:25:14FromDiscord<haxscramper> It doesn't change anything here actually - unless I edit `std/sets.difference` nothing works
15:25:30FromDiscord<haxscramper> Need to make smaller example actually
15:25:52disrupteki'm not sure it's wrong, honestly.
15:29:08FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2E9y
15:29:26*natrys joined #nim
15:30:32disruptekwell, if you make it explicit, the sugar doesn't run.
15:31:21disruptekprobably the sugar isn't working correctly and this is another reason not to use it.
15:33:09FromDiscord<haxscramper> `for val in u: discard` should be identical to `for val in items(u): discard`, right? But it seems that it is not. Just another argument against `3`. And `.items` call can also suffer from some symbol resolution issues, so `items()` it the safest one. For generic code especially
15:47:32disruptekyou mean ufcs issues with templates?
15:48:45disrupteki've stopped using () for calls with a single argument unless the syntax is ambiguous.
16:09:52FromDiscord<shadow.> is there any way to copyMem into a tuple? for instance copying into a tuple(uint16, uint16) from an array[4, uint8]
16:11:30*evilkhaoskat quit ()
16:13:35FromDiscord<lqdev> yeah
16:13:42FromDiscord<Idefau> you could declare a type as a tuple of some length
16:13:50FromDiscord<Idefau> then you have your destination variable as that type
16:13:56FromDiscord<lqdev> copyMem(yourTuple.addr, yourArray[0].addr, sizeof(yourTuple))
16:14:04FromDiscord<shadow.> alr lemme try that ty
16:14:59FromDiscord<shadow.> worked, thanks
16:15:02*weeqw joined #nim
16:16:50*superbia quit (Quit: WeeChat 2.9)
16:18:21*weeqw quit (Quit: Leaving)
16:22:06FromDiscord<shadow.> well thats a much easier way to send packets lol
16:22:19FromDiscord<shadow.> just copy mem from a Packet tuple into a string and then copy mem into a Packet tuple
16:22:27FromDiscord<shadow.> (edit) "just copy mem from a Packet tuple into a string and then copy mem into a Packet tuple ... " added "from the string"
16:33:21disruptek~ufcs
16:33:22disbotno footnotes for `ufcs`. 🙁
16:34:08disruptek~ufcs is a misnomer. See https://gist.github.com/disruptek/6d0cd6774d05adaa894db4deb646fc1d for one set of opinions.
16:34:09disbotufcs: 11a misnomer. See https://gist.github.com/disruptek/6d0cd6774d05adaa894db4deb646fc1d for one set of opinions.
16:35:06*PMunch quit (Quit: leaving)
16:43:26*a_chou joined #nim
16:43:34*natrys quit (Ping timeout: 246 seconds)
16:56:38*natrys joined #nim
16:59:47*stever left #nim (#nim)
17:00:12*a_chou quit (Remote host closed the connection)
17:06:50*xet7 quit (Remote host closed the connection)
17:08:13*xet7 joined #nim
17:23:35*narimiran joined #nim
17:35:45*mmohammadi9812 quit (Read error: Connection reset by peer)
17:35:56*mmohammadi9812 joined #nim
17:40:32*mmohammadi9812 quit (Ping timeout: 256 seconds)
17:42:34*mmohammadi9812 joined #nim
17:56:53FromDiscord<shad0w> @shadow. hey, you sound familiar ~.^
17:57:33FromDiscord<shadow.> hmm
17:57:37FromDiscord<shadow.> indeex
17:57:38FromDiscord<shadow.> (edit) "indeex" => "indeed"
18:00:56*xet7 quit (Quit: Leaving)
18:18:54FromDiscord<Daniel> just discovered this video, watching: 👍 ↵https://www.youtube.com/watch?v=O8Y4faZPnsc↵@PMunch
18:24:40*xet7 joined #nim
18:25:01*vicfred_ joined #nim
18:27:44*vicfred quit (Ping timeout: 260 seconds)
18:29:36*kinkinkijkin quit (Remote host closed the connection)
18:29:38Zevvdisruptek: return in expr?
18:29:40Zevvwhats that
18:52:18*NimBot joined #nim
19:00:05*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
19:01:34*pbb joined #nim
19:23:16*hnOsmium0001 joined #nim
19:29:11FromGitter<ynfle> is `@` on a seq a noop?
19:52:47Zoom[m]If multidim openArrays are not supported, how do I pass them to a function?
20:06:45FromGitter<ynfle> `seq[seq[int]]`
20:06:58FromGitter<ynfle> Or use a matrix library
20:09:44Zoom[m]ynfile, nope you can't pass arrays if a function requires seqs, can't you? That's the point of having openArray in the first place, right?
20:13:41planetis[m]Hey checkout brand new macro writing dsl! https://github.com/nim-lang/fusion/pull/40
20:13:42disbotAdded macro dsl based on karaxdsl
20:14:01planetis[m]its fresh
20:14:35planetis[m]can use some testers
20:21:48FromDiscord<Rebel> Are there any packages to easily interact with smb in Nim?
20:23:57planetis[m]Have you checked nimble.directory ?
20:24:31haxscramperplanetis[m]: `isMainModule.cases` is an example of use?
20:24:54planetis[m]well yes
20:26:27FromGitter<ynfle> @zoom, Yes but you can make a generic
20:26:34planetis[m]it was taken from a script i made, it builds a fsm from a table
20:26:47haxscramperThis is mostly the same as `makeTree` from `fusion/matching` - https://github.com/haxscramper/fusion/blob/matching/tests/tMatching.nim#L727 (except this one does not allow to splice logic and code generation - only to create tree)
20:27:30haxscrampers/this/one from matching/
20:28:08*natrys quit (Quit: natrys)
20:28:33planetis[m]isn't that pattern matching?
20:28:52haxscramperNo, this is construction of the tree, just using the same DSL
20:29:08haxscramperThe same parser for DSL. Like pattern matching but in reverse
20:30:00planetis[m]its huge you put a lot of effort on it
20:30:53planetis[m]i just copied karaxdsl, hope it's useful to other ppl
20:32:01FromGitter<ynfle> @Zoom, Here is an implementation using generics https://play.nim-lang.org/#ix=2Eb2
20:32:46*habamax quit (Ping timeout: 244 seconds)
20:33:42Zoom[m]ynfle, thanks. there's a place in the docs and/or nimbyexample for this somewhere!
20:33:54*Axiomatic left #nim ("Leaving")
20:34:13haxscramperplanetis[m]: Yeah, I thought that too. I'm not familliar with karax though, so maybe there is some things besides splicing logic and ast generation? `makeTree` is not a full 'reverse' - things like `all` etc. are not supported yet. With these additions there would probably be an overlap on feaures
20:34:42FromGitter<ynfle> Are you asking if there is place in the docs for this application of generics specifically? Not that I'm aware of
20:34:59FromGitter<ynfle> ~generics
20:34:59disbotno footnotes for `generics`. 🙁
20:35:22FromGitter<ynfle> https://nim-lang.org/docs/manual.html#Generics
20:35:43Zoom[m]This was not a question :) I meant the docs should mention this possibility right after saying you can't have multidim openarrays.
20:42:42planetis[m]haxscramper: no thats exactly what it does. Its quite good
20:43:19planetis[m]Im not familiar with maketree but will check it
20:45:24planetis[m]I must say im quite satisfied with how it turned. I mean repurposing a web dsl into macros and its just working
20:46:49planetis[m]I want to show @Araq after all he wrote all the logic
20:47:52haxscramperhttps://raw.githubusercontent.com/haxscramper/fusion/matching/src/fusion/matching.rst - for `makeTree` (github can't deal with `.. code:: nim`, so link is to raw `.rst`).
20:49:51planetis[m]haxscramper: are you aware of https://github.com/krux02/ast-pattern-matching ?
20:49:55haxscramperYes
20:50:20haxscramperYes, I'm aware of absolutely all pattern matching implementations for nim
20:51:08haxscramperBut `ast-pattern-matching` is not generic (e.g only `NimNode`)
20:52:59haxscramperPattern /matching/ dsl alreay supports loops in form of `all`, `any`, `none`, and `until` as well as custom predicates. Just need to come up with semantics for `makeTree` that would exactly mirror `match` part.
20:56:44planetis[m]All these sound so complicated to me, i have to admit
20:59:02haxscramperYou can match nim node using `matches:⮒ StmtList[all @statements]` - and it will inject `statements` variable. So it is logical (well, at least to me) to think that `makeTree:⮒ StmtList[all @statements]` would create `StmtList` node and add all elements from `statements`.
20:59:39planetis[m]yes that makes sense
21:00:47FromDiscord<notchris> Hello friends
21:01:02notchriso/
21:02:16haxscramperBut the problem is - I also have `StmtList[until @elements is Ident(strVal: "stop")]` that would capture elements until first `stop` identifier in statment list. But for `makeTree` it might be a bit pointless. Though kind of logical to expect, so I would probably stick to it too.
21:04:18planetis[m]Now that you explain it, it all makes sense, its just im not used to program declaretively
21:07:17haxscramperGood point actually. I kind of forgot about this, so should probably include more examples of how things like `all` etc. map into for loops/ifs and so on.
21:18:14*stefantalpalaru quit (Ping timeout: 244 seconds)
21:20:20*vicfred_ quit (Quit: Leaving)
21:26:14*Nimer4-2 joined #nim
21:35:34*vesper11 joined #nim
21:49:54*haxscramper quit (Remote host closed the connection)
21:52:42FromDiscord<notchris> if i have a C lib that is just a UI bundled into a single header file
21:52:50*narimiran quit (Ping timeout: 264 seconds)
21:53:01FromDiscord<notchris> whats the easiest way to interact with it without using c2nim etc
21:53:45FromDiscord<nikki> `proc foo(blah: cstring, bleh: int): int {.importc, header: "\"theheader.h\"".}`
21:53:53FromDiscord<nikki> should let you call eg. foo from the lib
21:54:10FromDiscord<notchris> so i need to find where its rendering to a surface and starting a window first right
21:54:59FromDiscord<nikki> depends on what the ui lib is saying i think. if it expects a window handle, or if it creates its own window etc. 🤔
21:55:39FromDiscord<notchris> hmmm
22:00:12*stefantalpalaru joined #nim
22:36:59ForumUpdaterBotNew thread by Spip: Life is nice..., see https://forum.nim-lang.org/t/7093
22:50:02Zoom[m]Huh, so it seems I need to `import enumerate` to use it, but I get "cannot open file"
23:01:31*stefantalpalaru quit (Changing host)
23:01:31*stefantalpalaru joined #nim
23:01:46*Axiomatic joined #nim
23:02:57FromDiscord<ElegantBeef> it quite possibly is under `std/enumerate`
23:04:02FromDiscord<ElegantBeef> Some of the more recent/smaller libraries require the `std/` afaik
23:04:54FromDiscord<j-james> What are some good GUI libraries for Nim?
23:06:07*Nimer4-2 quit (Remote host closed the connection)
23:06:41FromDiscord<ElegantBeef> Fidget, Nimx, WebGUI
23:06:54*Axiomatic left #nim ("Leaving")
23:07:26FromDiscord<ElegantBeef> What type of GUI do you want though, "native" or native?
23:09:29FromDiscord<j-james> I suppose native
23:09:55FromDiscord<j-james> This is mostly for learning, not for a full-fledged project
23:10:08FromDiscord<ElegantBeef> Well then you've got Nigui if you want cross platform native
23:10:39FromDiscord<ElegantBeef> It's also "native" since on linux/mac it uses gtj
23:10:42FromDiscord<ElegantBeef> (edit) "gtj" => "gtk"
23:10:56FromDiscord<ElegantBeef> But on windows it does use windows GUI, so close enough
23:16:07FromDiscord<j-james> Thanks, I'll give that a whirl
23:16:24*solitudesf quit (Ping timeout: 256 seconds)
23:28:56FromDiscord<ElegantBeef> So i'm curious is the `_` in `for _ in 0..10` supposed to be accessible, I know underscore is the unused indicator and if you do it in a `let _ = 100` then try to access it the identfier doesnt exist, shouldnt it be the case for `for` aswell?
23:38:40FromDiscord<nikki> i think it's not supposed to be accessible
23:38:52FromDiscord<nikki> like you can do `for _, _ in ...` -- and if it was accessible that would cause an ambiguity
23:39:13*lritter quit (Remote host closed the connection)
23:39:35FromDiscord<nikki> one "somewhat analogous" place where you can't actually do multiple `_` is in parameter lists -- like you can't do `proc(_, _: int)` to take two `int`s that you ignore iirc
23:46:11FromDiscord<krabbypatty> huh
23:46:20FromDiscord<krabbypatty> nim accepts both `case x` and `case x:`
23:47:04FromDiscord<krabbypatty> first one should be probably emit a syntax error?
23:47:09FromDiscord<krabbypatty> (edit) removed "be"
23:51:25FromDiscord<ElegantBeef> @nikki yea that was my intuition as well but it's for a normal `for _ in iterator`
23:51:33FromDiscord<ElegantBeef> So i guess time to make an issue 😄
23:52:46FromDiscord<nikki> @ElegantBeef yea it's accessible indeed
23:52:54FromDiscord<nikki> 🤔
23:53:20FromDiscord<ElegantBeef> I used the playground and it compiles in every version
23:53:23FromDiscord<ElegantBeef> So it's weird indeed