<< 04-03-2026 >>

00:39:29*beholders_eye quit (Ping timeout: 245 seconds)
00:39:29FromDiscord<zillikescoding> hey guys
00:39:31FromDiscord<zillikescoding> @here
00:39:38FromDiscord<zillikescoding> how did all of you learn nim
00:39:47FromDiscord<zillikescoding> i litterly just known about it and i want to learn it
00:41:01nmzaintea, do you know any solutions to my problem?
00:42:09FromDiscord<aintea> Your last message was "AYe" which I didn't really understand
00:42:20nmzuhh
00:42:25FromDiscord<aintea> I understand you're trying to remake a sed command
00:42:27nmzaye means yeah
00:42:36FromDiscord<aintea> but I'm not sure exactly on what feature you're having issues
00:42:47FromDiscord<aintea> I asked you "what issue do you have" and you answered "AYe"
00:42:49FromDiscord<zillikescoding> In reply to @aintea "but I'm not sure": howd you learn nim?
00:42:56FromDiscord<zillikescoding> im jsut really curios
00:42:59nmzin court for example, whenever a voting happens, congressman say "aye" or "nay" which means yes or no
00:43:00FromDiscord<zillikescoding> i just knew about the laungage
00:43:16FromDiscord<aintea> The nim book, Nim Days, Learn Nim in Y minutes
00:43:21FromDiscord<aintea> and practicing with advent of code
00:43:23FromDiscord<zillikescoding> thx
00:43:29FromDiscord<zillikescoding> In reply to @nmz "in court for example,": why are you a app?
00:43:32FromDiscord<zillikescoding> but talk like a human
00:43:36nmzits a very common word
00:43:43FromDiscord<aintea> In reply to @nmz "in court for example,": you answered "yes" when I asked what the exact problem was
00:43:49FromDiscord<aintea> Which is a bit confusing lmao
00:46:31nmzWelp...
00:46:35nmzanyway
00:46:39nmzis there an answer?
00:47:02FromDiscord<aintea> At the moment I don't understand your exact problem, so I'd say no
00:47:11FromDiscord<aintea> sorry
00:47:14nmzoh, are you a windows user?
00:47:33nmznow I notice that windows users don't know sed
00:48:23nmzfor line in stdin.lines: echo line -> This adds an extra newline at the end
00:48:50nmz* this code is wrong because it adds an extra newline at the end
00:48:56nmzSo I'm trying to fix that code
00:51:23FromDiscord<aintea> You'd have two solutions
00:51:54FromDiscord<aintea> Either use a for loop with an int and then check if it's the last line printed, if not add a newline↡↡Or make your list of lines as string in advance and join it with '\n'
00:52:58FromDiscord<aintea> for example
00:53:30FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=yOkZjvMD
00:55:46FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=UFsYvtqG
00:58:12FromDiscord<aintea> this way, no added extra line at the end
00:59:46nmzwhat the
01:00:26nmzno, that's not it either
01:01:10nmzthat's really redundant, write line already writes the line without any need for looping
01:05:14nmznow I'm not understanding you, ha
01:05:23nmzanyway, I give up, I'll just stick to sed
01:06:08FromDiscord<nasuray> In reply to @nmz "anyway, I give up,": Do you care if the whole file is ready into memory?
01:06:14nmzI do
01:07:10nmzelse I would've readall and just replaced all \n with "\n "
01:07:30nmzwhich isn't a bad idea, but that wouldn't be better than sed or the C version
01:11:19FromDiscord<nasuray> In reply to @nmz "else I would've readall": So you want to ignore a newline if it's in the final position though? May require checking the cursor position on a file object
01:12:20FromDiscord<nasuray> Or do a two pass iteration and track the line number
01:25:30*ftajhii joined #nim
01:34:32*gabreal joined #nim
01:35:24*gabreal quit (Client Quit)
01:37:32*rockcavera quit (Remote host closed the connection)
01:44:41nmzI don't want to ignore the newline, that's the point, I want to edit a single line, without changing all other lines.
01:44:48nmzor the last line
01:51:24nmzbasically stdout.write( stdin.readall() ) does the right thing, but now you have to watch out for memory, so doing it iteratively is a better deal
01:51:47nmzCan you check the cursor position on stdin?
02:25:16FromDiscord<aintea> afaik stdin is like a stream, you don't know how much you still have to read except if you put all of stdin into a buffer
02:32:04*mrinsane quit (Ping timeout: 268 seconds)
02:34:41FromDiscord<nasuray> Don't know about cursor position on stdin but it's a File https://github.com/nim-lang/Nim/blob/b8e13bd421d37c3f06c59a5ac5c50e051785ad9d/lib/std/syncio.nim#L67
07:32:15Amun-Raseek and tell on stdin/stdout are possible only if stream is seekable; C does not guarantee that
07:32:27Amun-Ra./foo | ./bar ← not seekable
07:49:34*SchweinDeBurg quit (Quit: WeeChat 4.8.0-dev)
07:53:08*SchweinDeBurg joined #nim
08:12:55*pmp-p quit (Ping timeout: 264 seconds)
08:13:03*pmp-p joined #nim
08:31:27*janAkali joined #nim
08:31:36janAkalinmz https://play.nim-lang.org/#pasty=XfxYYwRs
08:37:50*CypherCat quit (Ping timeout: 252 seconds)
08:45:28*janAkali quit (Ping timeout: 240 seconds)
08:55:35*janAkali joined #nim
09:02:47*beholders_eye joined #nim
09:11:27*beholders_eye quit (Quit: WeeChat 4.8.1)
09:11:35*beholders_eye joined #nim
09:23:14FromDiscord<gesee37> In reply to @zillikescoding "why are you ": Well you made me smile πŸ˜‚
10:13:50*janAkali quit (Quit: Client closed)
13:36:07*hygo quit (Quit: WeeChat 4.6.3)
14:12:05*hygo joined #nim
16:24:20*mrinsane joined #nim
18:00:22*CypherCat joined #nim
18:08:08*lumidify quit (Remote host closed the connection)
18:09:44*lumidify joined #nim
18:52:34*beholders_eye quit (Ping timeout: 268 seconds)
19:11:19*joast quit (Quit: Leaving.)
19:21:37FromDiscord<zillikescoding> In reply to @nmz "oh, are you a": why is everyone a app 😭
20:09:57*joast joined #nim
20:21:31FromDiscord<muddmaker> Matrix bridge?
20:31:58*redj_ joined #nim
20:32:09*redj quit (Ping timeout: 248 seconds)
21:00:08FromDiscord<gesee37> In reply to @zillikescoding "why is everyone a": Don't try to understand it's like how kittens come to be, Don't try to understand, take it as it is πŸ˜‚
21:11:20*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
21:13:53*Lord_Nightmare joined #nim
21:33:48*beholders_eye joined #nim
21:35:10FromDiscord<n7itro> Does anyone know how you can make every anonymous proc have `{.noSideEffects.}`? Push/pop pragmas do nothing
21:37:38FromDiscord<shalokshalom> Isnt there an anonymous `func` πŸ‘€
21:37:55FromDiscord<n7itro> Is there?
21:39:18FromDiscord<n7itro> maybe like `x ~> x - a` to `x {.noSideEffect.} => x - a`
21:40:23*rockcavera joined #nim
21:40:51FromDiscord<shalokshalom> Just ... `func` instead of `proc`?
21:41:50FromDiscord<shalokshalom> https://nim-lang.org/docs/manual.html#nosideeffect_1
21:42:11FromDiscord<shalokshalom> There is no arrow, sadly. But thats about it, you should be good to go πŸ™‚
21:43:09FromDiscord<n7itro> sent a code paste, see https://play.nim-lang.org/#pasty=xDLpfNwW
21:43:18FromDiscord<n7itro> (edit) "https://play.nim-lang.org/#pasty=cTEsnWiC" => "https://play.nim-lang.org/#pasty=FcnCNzMS"
21:44:22FromDiscord<n7itro> Nvm I figured it out...
21:44:49FromDiscord<shalokshalom> It should maybe be explicitly mentioned in the docs, that you can use it anonymously.
21:45:02FromDiscord<shalokshalom> (edit) "It" => "Maybe it" | removed "maybe" | "docs," => "docs"
21:45:25FromDiscord<n7itro> Well you can use it anonymously, but I wanted to apply it to all anonymous procs at once so I don't need to write out that pragma each time
21:45:34FromDiscord<n7itro> I got it though, some macro magic
21:45:43FromDiscord<shalokshalom> Ah, ok. Probably also worth mentioning somewhere πŸ˜„
21:46:04FromDiscord<n7itro> Might PR `std/sugar`
21:59:41FromDiscord<ryano3797> sent a code paste, see https://play.nim-lang.org/#pasty=ROSyHfNv
21:59:49FromDiscord<ryano3797> What am I doing wrong?
21:59:59*gabreal joined #nim
22:01:55FromDiscord<shalokshalom> Is the Nim version of choosenim supposed to support the `run` flag?
22:31:08FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=FBCgFtID
22:49:32FromDiscord<ryano3797> Ah, so close. Thank you!
23:01:45FromDiscord<ryano3797> Hm, reading through the documentation more. This doc: https://nim-lang.org/docs/system.html#example uses `Thread[void]` (without the `()` at the end). When I tried that it didn't work. It seems the parens are necessary, but...only sometimes?
23:09:59FromDiscord<nasuray> In reply to @ryano3797 "Hm, reading through the": That is a type definition not an expression! Both are valid ways to initialize the var
23:11:26FromDiscord<ryano3797> It doesn't work for me when I try that; if I omit the parens, I get:↡↡`Error: invalid type: 'typedesc[Thread[system.void]]' for var`
23:12:41FromDiscord<ryano3797> It doesn't work for me when I try that. If I omit the parens, I get:↡↡`Error: invalid type: 'typedesc[Thread[system.void]]' for var`
23:13:43FromDiscord<nasuray> it's `var thread: Thread[void]`
23:14:44FromDiscord<nasuray> vs `var thread = Thread[void]()`
23:15:48FromDiscord<ryano3797> Right. So when you said both are valid ways to initialize the var, what does that mean? Without the final `()`, I get the compile error.
23:16:19FromDiscord<ryano3797> Oooooh, never mind, I see. I missed the : vs = bit.
23:18:26FromDiscord<ryano3797> Huh, okay. In all my readings I don't think I've come across this syntax yet. I thought type definitions went into a `type` block.
23:21:05FromDiscord<ryano3797> sent a code paste, see https://play.nim-lang.org/#pasty=LkBrCKzO
23:23:11FromDiscord<ryano3797> sent a code paste, see https://play.nim-lang.org/#pasty=ysqqUcKL
23:25:45FromDiscord<nasuray> In reply to @ryano3797 "Okay, so this works:": For these nothing but IIRC default values for an object will only be used if it's initialized with an object constructor https://nim-lang.org/docs/manual.html#types-default-values-for-object-fields
23:28:29FromDiscord<ryano3797> sent a code paste, see https://play.nim-lang.org/#pasty=WWyxVJPM
23:28:40FromDiscord<ryano3797> (edit) "https://play.nim-lang.org/#pasty=zwBpyExw" => "https://play.nim-lang.org/#pasty=zGAjGMIh"
23:29:57FromDiscord<nasuray> In reply to @ryano3797 "Ah, okay, so the": Yep! Luckily Nim can infer types so when assigning it's not needed
23:30:13FromDiscord<ryano3797> Cool, alright, I think I get it now. Thanks!