<< 08-09-2024 >>

00:01:04*beholders_eye joined #nim
00:16:17FromDiscord<sirius_3x> how do I convert a tuple into a JSON object?
00:17:34FromDiscord<sirius_3x> (edit) "object?" => "object string? is there any built-in function for that?↵I already tried $ and % but they output something like this:↵"(name: \"Alice\", age: 30, isStudent: false, skills: [\"nim\", \"python\", \"cpp\"])""
00:19:15FromDiscord<sirius_3x> sent a long message, see https://pasty.ee/ZRXGtRHK
00:19:53FromDiscord<sirius_3x> (edit) "long message," => "code paste," | "https://pasty.ee/QCoPlrRB" => "https://play.nim-lang.org/#pasty=OjJGXYWK"
00:20:48FromDiscord<Elegantbeef> `%(bleh).pretty`
00:26:14FromDiscord<sirius_3x> In reply to @Elegantbeef "`%(bleh).pretty`": ty for the quick response but %() doesnt seem to work on tuples, is that right?
00:27:58FromDiscord<sirius_3x> sent a code paste, see https://play.nim-lang.org/#pasty=OwdmBxSY
00:28:11FromDiscord<sirius_3x> (edit) "https://play.nim-lang.org/#pasty=QAVmtntA" => "https://play.nim-lang.org/#pasty=ldnjkAZy"
00:28:44FromDiscord<sirius_3x> With or without pretty
00:29:54*lucasta quit (Remote host closed the connection)
00:30:31FromDiscord<Elegantbeef> Guess you need `%`
00:30:40FromDiscord<Elegantbeef> I do not recall these asinine operators
00:30:45FromDiscord<sirius_3x> xD
00:31:02FromDiscord<sirius_3x> In reply to @Elegantbeef "Guess you need `%*`": still doesnt seem to work though :/
00:31:11FromDiscord<sirius_3x> any third party library you can recommend?
00:33:01FromDiscord<sirius_3x> nvm think I mightve found one, ty for your help btw
00:33:28FromDiscord<Elegantbeef> You can just write the `%` for a tuple
00:34:57FromDiscord<sirius_3x> sent a code paste, see https://play.nim-lang.org/#pasty=xwHhRJul
00:35:02FromDiscord<sirius_3x> In reply to @Elegantbeef "You can just write": throws an error
00:35:17FromDiscord<sirius_3x> (edit) "https://play.nim-lang.org/#pasty=bJykBraO" => "https://play.nim-lang.org/#pasty=WSaapVAz"
00:35:59FromDiscord<sirius_3x> unless I convert it to a string first, via $, but that kinda defeats the purpose
00:37:54FromDiscord<Robyn [She/Her]> In reply to @sirius_3x "any third party library": jsony and sunny are good
00:38:12FromDiscord<Elegantbeef> Neither do pretty json though
00:38:58FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Neither do pretty json": you can convert to a JsonNode
00:39:28FromDiscord<Elegantbeef> So bring in a dependency for no reason
00:39:30FromDiscord<Robyn [She/Her]> `fromJson(JsonNode, myTup.toJson())`, iirc
00:39:35FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "So bring in a": shrug
00:42:54FromDiscord<Elegantbeef> Heh not only bringing in a dependency but converting to a json string then parsing back to a json node to then store as a json string
00:42:56FromDiscord<Elegantbeef> Steps for days
00:45:33*beholders_eye quit (Read error: Connection reset by peer)
00:46:23FromDiscord<sirius_3x> sent a code paste, see https://play.nim-lang.org/#pasty=ApbMPzfE
00:46:55FromDiscord<sirius_3x> (edit) "https://play.nim-lang.org/#pasty=kJmujHtl" => "https://play.nim-lang.org/#pasty=vwvNpVHH"
00:47:12FromDiscord<Elegantbeef> I jusut showed you how
00:47:15FromDiscord<Elegantbeef> just\
00:47:25FromDiscord<Elegantbeef> Bridge moment
00:47:37FromDiscord<Elegantbeef> https://play.nim-lang.org/#pasty=CEJqVMSr
00:47:44FromDiscord<Elegantbeef> What a bridge
00:51:22*beholders_eye joined #nim
00:52:14FromDiscord<sirius_3x> Thanks, that code does actually work! However, if I omit the proc that you copied from stdlib, it doesnt work. Idk why. I thought this function is part of the std library? Doesn't it get imported for some reason?↵The other thing is, your original answer actually had the % outside of the brackets, thats why it also wouldnt work
00:52:36FromDiscord<Elegantbeef> The stdlib's `%` for whatever reason does not work with tuples
00:52:51FromDiscord<sirius_3x> In reply to @Elegantbeef "The stdlib's `%` for": so you did actually just write a custom function for that lmao
00:53:08FromDiscord<Elegantbeef> Well I stole the stdlib's object code
00:53:11FromDiscord<Elegantbeef> Since it's the same thing
00:53:54FromDiscord<Elegantbeef> Operators bind to the entire expression not the first part
00:54:10FromDiscord<Elegantbeef> so `$bleh[0].meh.huh` is `$(bleh[0].meh.huh)`
00:54:10FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Well I stole the": using fieldPairs on a named tuple?
00:54:24FromDiscord<Elegantbeef> You can use it on all tuples
00:54:31FromDiscord<sirius_3x> In reply to @Elegantbeef "Well I stole the": oh true, smart actually, lol↵thanks again
00:54:32FromDiscord<Elegantbeef> Doesn't matter if it's named or unnamed
00:54:38FromDiscord<Elegantbeef> If it's unnamed you get `Field0`....
00:54:42FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "You can use it": oh?
00:54:47FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "If it's unnamed you": damn, neat
00:56:50*beholders_eye quit (Ping timeout: 252 seconds)
01:00:06*albe4 joined #nim
01:01:37FromDiscord<nervecenter> In reply to @sirius_3x "are you sure? Because": If there's a way to convert a tuple to a seq first that might be a good middle ground
01:02:16FromDiscord<Elegantbeef> tuple to a seq.... that only works if the tuple is singly typed
01:02:18*albe quit (Ping timeout: 244 seconds)
01:02:19*albe4 is now known as albe
01:03:52FromDiscord<sirius_3x> In reply to @nervecenter "If there's a way": Elegantbeef also already kindly provided a function that converts any tuple to a JSONobject
01:04:50FromDiscord<nervecenter> In reply to @Elegantbeef "tuple to a seq....": right, dang forgot about that
01:05:28FromDiscord<nervecenter> yeah beef's proc is exactly what I would do given the constraints
01:05:47FromDiscord<nervecenter> iterate over the values and drop them in a new JArray
01:05:52FromDiscord<Elegantbeef> It's what the stdlib should do `T: object | tuple` instead of just `T: object`
01:06:10FromDiscord<Elegantbeef> You also misread their goal nerve
01:06:17FromDiscord<Elegantbeef> They want to have a prettified json object
01:06:48FromDiscord<nervecenter> Oh I see it's a named tuple
01:06:55FromDiscord<nervecenter> please ignore me I am not thinking atm
01:15:34FromDiscord<sirius_3x> In reply to @Elegantbeef "It's what the stdlib": beef, are you creating a pull request for that? cause if not then I will
01:35:46FromDiscord<sirius_3x> In reply to @Elegantbeef "It's what the stdlib": nvm I just created one and made sure to credit you in the description, in case thats important to you. hope you dont mind.
03:16:30*xutaxkamay quit (Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in)
03:16:40*xutaxkamay_ joined #nim
03:17:29*xutaxkamay_ is now known as xutaxkamay
03:53:40*SchweinD1 quit (Quit: WeeChat 4.5.0-dev)
03:54:24*SchweinDeBurg joined #nim
05:10:09*albe quit (Quit: The Lounge - https://thelounge.chat)
05:10:32*albe joined #nim
06:10:32*coldfeet joined #nim
06:36:01*xet7 quit (Ping timeout: 272 seconds)
07:00:11*ntat joined #nim
08:13:10*coldfeet quit (Remote host closed the connection)
08:34:40*xet7 joined #nim
08:56:25*coldfeet joined #nim
09:15:12*mfg joined #nim
10:01:19FromDiscord<floppy._disk> Any updates on getting the neovim lsp working properly? I still can't get it complete keywords and import paths
10:10:31*ntat quit (Quit: Leaving)
10:26:16*mfg quit (Ping timeout: 252 seconds)
11:21:22*coldfeet quit (Remote host closed the connection)
13:10:32*disso-peach joined #nim
13:33:58*coldfeet joined #nim
14:03:04FromDiscord<aintea> I can, but sometimes it just crashes
14:03:25FromDiscord<aintea> Sometimes it works great, but some other times it just... decides to do its thing
14:04:18FromDiscord<aintea> To fix it I just uninstall it and then install it back again
14:16:40*beholders_eye joined #nim
14:31:26*ntat joined #nim
15:36:56FromDiscord<melmass> Macros are much easier than I expected!↵I’m still confused on to when to use template vs macros, vs {.compileTime.} procs ?
15:37:58FromDiscord<melmass> (Macros or template with only static arguments)
15:41:27FromDiscord<melmass> Also is there a way to define submodules of the same module as multiple packages?↵Like a namespace but published as separate modules: import namespace/moduleA
15:51:27FromDiscord<demotomohiro> Basically, if you can implement it with proc, use proc.↵If you cannot implement it with proc but template or macro, use template.↵I use just use simplest one.
15:51:42FromDiscord<demotomohiro> (edit) removed "use"
17:47:20*xet7 quit (Ping timeout: 272 seconds)
18:03:09*lucasta joined #nim
18:13:45FromDiscord<Benjamin James> sent a long message, see https://paste.rs/J5EiR
18:54:19*ntat quit (Quit: Leaving)
19:05:19FromDiscord<goerge_lsd> anyone know of alternative (better) http clients for nim ? Interested in partial downloads of files
19:11:08FromDiscord<goerge_lsd> found this https://github.com/lantos1618/nim-http but having trouble importing it. If I put main url in .nimble, it says there's no .nimble file. If I give it https://github.com/lantos1618/nim-http/tree/master/nim_http nimble complained not having `hg` (mercurial) in path for some reason. After I installed it, it says U`nable to identify url:`
19:14:33*beholders_eye quit (Ping timeout: 276 seconds)
19:39:13FromDiscord<ryzh.> Error starting nimlangserver: could not load: pcre64.dll
20:07:29*coldfeet quit (Remote host closed the connection)
21:11:21FromDiscord<solitudesf> sent a code paste, see https://play.nim-lang.org/#pasty=WIVHWTNI
21:13:44FromDiscord<BillBraskey> Obby is that the location of your package in that parameter or are you just happy to see me
21:15:41FromDiscord<goerge_lsd> nim std httpclient still doesn't work with streams ?
21:17:55FromDiscord<goerge_lsd> guess not: https://github.com/nim-lang/Nim/issues/13856
22:10:09FromDiscord<goerge_lsd> well, doesn't work. I am thinking maybe these files have to manually be replaced in the filesystem ? https://github.com/lantos1618/nim-http/tree/master/nim_http/src/patches
22:10:50FromDiscord<goerge_lsd> oh wait, there's a patchFile command in config.nims: https://github.com/lantos1618/nim-http/blob/8df873ffd92d6d576b5a4e0423cb528c90e6339a/config.nims#L2
22:24:27FromDiscord<goerge_lsd> well it seems to use recvLine in the code for the "chunking", which is quite useless if data is binary
22:38:45FromDiscord<determiedmech1> do any of you know if Nim has RISC-V support
22:40:19FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/79a65da22a56eaeafce24b7c08c9d7db017173ac/lib/system/platforms.nim#L38-L39
22:46:19*xutaxkamay quit (Ping timeout: 260 seconds)
23:35:05FromDiscord<nervecenter> In reply to @determiedmech1 "do any of you": I have compiled on RISC-V, works pretty well. My only issue was needing to turn off SIMD using a flag for the zippy package.
23:35:21FromDiscord<determiedmech1> W
23:35:23FromDiscord<determiedmech1> thx
23:35:41FromDiscord<nervecenter> I've done both native compilation (compiled Nim 2.0.8 on RISC-V), and cross-compilation using a RISC-V toolchain from x86.
23:36:07FromDiscord<determiedmech1> I was just wondering because opencomputers2(Minecraft mod) uses RISC-V vms for the computers and I thought it would be interesting to use Nim in minecraft