<< 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