| 00:39:29 | * | beholders_eye quit (Ping timeout: 245 seconds) |
| 00:39:29 | FromDiscord | <zillikescoding> hey guys |
| 00:39:31 | FromDiscord | <zillikescoding> @here |
| 00:39:38 | FromDiscord | <zillikescoding> how did all of you learn nim |
| 00:39:47 | FromDiscord | <zillikescoding> i litterly just known about it and i want to learn it |
| 00:41:01 | nmz | aintea, do you know any solutions to my problem? |
| 00:42:09 | FromDiscord | <aintea> Your last message was "AYe" which I didn't really understand |
| 00:42:20 | nmz | uhh |
| 00:42:25 | FromDiscord | <aintea> I understand you're trying to remake a sed command |
| 00:42:27 | nmz | aye means yeah |
| 00:42:36 | FromDiscord | <aintea> but I'm not sure exactly on what feature you're having issues |
| 00:42:47 | FromDiscord | <aintea> I asked you "what issue do you have" and you answered "AYe" |
| 00:42:49 | FromDiscord | <zillikescoding> In reply to @aintea "but I'm not sure": howd you learn nim? |
| 00:42:56 | FromDiscord | <zillikescoding> im jsut really curios |
| 00:42:59 | nmz | in court for example, whenever a voting happens, congressman say "aye" or "nay" which means yes or no |
| 00:43:00 | FromDiscord | <zillikescoding> i just knew about the laungage |
| 00:43:16 | FromDiscord | <aintea> The nim book, Nim Days, Learn Nim in Y minutes |
| 00:43:21 | FromDiscord | <aintea> and practicing with advent of code |
| 00:43:23 | FromDiscord | <zillikescoding> thx |
| 00:43:29 | FromDiscord | <zillikescoding> In reply to @nmz "in court for example,": why are you a app? |
| 00:43:32 | FromDiscord | <zillikescoding> but talk like a human |
| 00:43:36 | nmz | its a very common word |
| 00:43:43 | FromDiscord | <aintea> In reply to @nmz "in court for example,": you answered "yes" when I asked what the exact problem was |
| 00:43:49 | FromDiscord | <aintea> Which is a bit confusing lmao |
| 00:46:31 | nmz | Welp... |
| 00:46:35 | nmz | anyway |
| 00:46:39 | nmz | is there an answer? |
| 00:47:02 | FromDiscord | <aintea> At the moment I don't understand your exact problem, so I'd say no |
| 00:47:11 | FromDiscord | <aintea> sorry |
| 00:47:14 | nmz | oh, are you a windows user? |
| 00:47:33 | nmz | now I notice that windows users don't know sed |
| 00:48:23 | nmz | for line in stdin.lines: echo line -> This adds an extra newline at the end |
| 00:48:50 | nmz | * this code is wrong because it adds an extra newline at the end |
| 00:48:56 | nmz | So I'm trying to fix that code |
| 00:51:23 | FromDiscord | <aintea> You'd have two solutions |
| 00:51:54 | FromDiscord | <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:58 | FromDiscord | <aintea> for example |
| 00:53:30 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#pasty=yOkZjvMD |
| 00:55:46 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#pasty=UFsYvtqG |
| 00:58:12 | FromDiscord | <aintea> this way, no added extra line at the end |
| 00:59:46 | nmz | what the |
| 01:00:26 | nmz | no, that's not it either |
| 01:01:10 | nmz | that's really redundant, write line already writes the line without any need for looping |
| 01:05:14 | nmz | now I'm not understanding you, ha |
| 01:05:23 | nmz | anyway, I give up, I'll just stick to sed |
| 01:06:08 | FromDiscord | <nasuray> In reply to @nmz "anyway, I give up,": Do you care if the whole file is ready into memory? |
| 01:06:14 | nmz | I do |
| 01:07:10 | nmz | else I would've readall and just replaced all \n with "\n " |
| 01:07:30 | nmz | which isn't a bad idea, but that wouldn't be better than sed or the C version |
| 01:11:19 | FromDiscord | <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:20 | FromDiscord | <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:41 | nmz | I 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:48 | nmz | or the last line |
| 01:51:24 | nmz | basically 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:47 | nmz | Can you check the cursor position on stdin? |
| 02:25:16 | FromDiscord | <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:41 | FromDiscord | <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:15 | Amun-Ra | seek and tell on stdin/stdout are possible only if stream is seekable; C does not guarantee that |
| 07:32:27 | Amun-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:36 | janAkali | nmz 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:14 | FromDiscord | <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:37 | FromDiscord | <zillikescoding> In reply to @nmz "oh, are you a": why is everyone a app π |
| 20:09:57 | * | joast joined #nim |
| 20:21:31 | FromDiscord | <muddmaker> Matrix bridge? |
| 20:31:58 | * | redj_ joined #nim |
| 20:32:09 | * | redj quit (Ping timeout: 248 seconds) |
| 21:00:08 | FromDiscord | <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:10 | FromDiscord | <n7itro> Does anyone know how you can make every anonymous proc have `{.noSideEffects.}`? Push/pop pragmas do nothing |
| 21:37:38 | FromDiscord | <shalokshalom> Isnt there an anonymous `func` π |
| 21:37:55 | FromDiscord | <n7itro> Is there? |
| 21:39:18 | FromDiscord | <n7itro> maybe like `x ~> x - a` to `x {.noSideEffect.} => x - a` |
| 21:40:23 | * | rockcavera joined #nim |
| 21:40:51 | FromDiscord | <shalokshalom> Just ... `func` instead of `proc`? |
| 21:41:50 | FromDiscord | <shalokshalom> https://nim-lang.org/docs/manual.html#nosideeffect_1 |
| 21:42:11 | FromDiscord | <shalokshalom> There is no arrow, sadly. But thats about it, you should be good to go π |
| 21:43:09 | FromDiscord | <n7itro> sent a code paste, see https://play.nim-lang.org/#pasty=xDLpfNwW |
| 21:43:18 | FromDiscord | <n7itro> (edit) "https://play.nim-lang.org/#pasty=cTEsnWiC" => "https://play.nim-lang.org/#pasty=FcnCNzMS" |
| 21:44:22 | FromDiscord | <n7itro> Nvm I figured it out... |
| 21:44:49 | FromDiscord | <shalokshalom> It should maybe be explicitly mentioned in the docs, that you can use it anonymously. |
| 21:45:02 | FromDiscord | <shalokshalom> (edit) "It" => "Maybe it" | removed "maybe" | "docs," => "docs" |
| 21:45:25 | FromDiscord | <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:34 | FromDiscord | <n7itro> I got it though, some macro magic |
| 21:45:43 | FromDiscord | <shalokshalom> Ah, ok. Probably also worth mentioning somewhere π |
| 21:46:04 | FromDiscord | <n7itro> Might PR `std/sugar` |
| 21:59:41 | FromDiscord | <ryano3797> sent a code paste, see https://play.nim-lang.org/#pasty=ROSyHfNv |
| 21:59:49 | FromDiscord | <ryano3797> What am I doing wrong? |
| 21:59:59 | * | gabreal joined #nim |
| 22:01:55 | FromDiscord | <shalokshalom> Is the Nim version of choosenim supposed to support the `run` flag? |
| 22:31:08 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=FBCgFtID |
| 22:49:32 | FromDiscord | <ryano3797> Ah, so close. Thank you! |
| 23:01:45 | FromDiscord | <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:59 | FromDiscord | <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:26 | FromDiscord | <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:41 | FromDiscord | <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:43 | FromDiscord | <nasuray> it's `var thread: Thread[void]` |
| 23:14:44 | FromDiscord | <nasuray> vs `var thread = Thread[void]()` |
| 23:15:48 | FromDiscord | <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:19 | FromDiscord | <ryano3797> Oooooh, never mind, I see. I missed the : vs = bit. |
| 23:18:26 | FromDiscord | <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:05 | FromDiscord | <ryano3797> sent a code paste, see https://play.nim-lang.org/#pasty=LkBrCKzO |
| 23:23:11 | FromDiscord | <ryano3797> sent a code paste, see https://play.nim-lang.org/#pasty=ysqqUcKL |
| 23:25:45 | FromDiscord | <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:29 | FromDiscord | <ryano3797> sent a code paste, see https://play.nim-lang.org/#pasty=WWyxVJPM |
| 23:28:40 | FromDiscord | <ryano3797> (edit) "https://play.nim-lang.org/#pasty=zwBpyExw" => "https://play.nim-lang.org/#pasty=zGAjGMIh" |
| 23:29:57 | FromDiscord | <nasuray> In reply to @ryano3797 "Ah, okay, so the": Yep! Luckily Nim can infer types so when assigning it's not needed |
| 23:30:13 | FromDiscord | <ryano3797> Cool, alright, I think I get it now. Thanks! |