00:29:50 | * | lucerne joined #nim |
01:34:01 | * | derpydoo joined #nim |
01:44:52 | NimEventer | New post on r/nim by DG4ME5: Is there any operator like the "..." of javascript in nim?, see https://reddit.com/r/nim/comments/z1gwhr/is_there_any_operator_like_the_of_javascript_in/ |
02:08:01 | * | arkurious quit (Quit: Leaving) |
02:13:18 | FromDiscord | <ChocolettePalette> sent a code paste, see https://play.nim-lang.org/#ix=4gvh |
02:19:57 | FromDiscord | <Elegantbeef> No they want `a & b` |
02:35:55 | FromDiscord | <ChocolettePalette> Too bad for them 😔 |
04:15:30 | * | xet7 quit (Ping timeout: 240 seconds) |
04:21:00 | * | derpydoo quit (Ping timeout: 256 seconds) |
05:50:11 | * | rockcavera quit (Remote host closed the connection) |
06:58:15 | * | LyndsySimon quit (Read error: Software caused connection abort) |
06:58:24 | * | LyndsySimon joined #nim |
07:37:14 | FromDiscord | <KatrinaKitten> sent a code paste, see https://play.nim-lang.org/#ix=4gvX |
07:37:38 | FromDiscord | <Elegantbeef> `astToStr` also look at `unittest.check` |
07:40:09 | FromDiscord | <KatrinaKitten> I'm aware of `unittest`, the example is purposely silly 🙂 |
07:40:34 | FromDiscord | <Elegantbeef> I was telling to look at `check` cause it does exactly what you want |
07:41:49 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/KFu |
07:52:50 | * | PMunch joined #nim |
07:56:10 | FromDiscord | <KatrinaKitten> Thanks, not quite what I needed but it put me on the right track and it works now |
09:16:50 | FromDiscord | <ratapenado> Hi, during my little tests with Nim I wasn't able to compile a file with a dash in its name. Is it something expected or did I do something wrong ? |
09:16:56 | FromDiscord | <ratapenado> (on windows btw) |
09:17:15 | FromDiscord | <Elegantbeef> Expected |
09:17:35 | FromDiscord | <Elegantbeef> `-` is not a valid in an identifier in Nim and all module names need to be valid identifiers |
09:28:40 | FromDiscord | <ratapenado> Ok thanks ! |
09:39:49 | NimEventer | New question by sneakyfishies: Issues with importing a library in nim test file, see https://stackoverflow.com/questions/74530407/issues-with-importing-a-library-in-nim-test-file |
09:58:41 | * | mal`` quit (Quit: Leaving) |
10:13:51 | FromDiscord | <hmmm> broskis what's the way of declaring a tuple similar to this for seqs: var a: seq[int] |
10:15:31 | FromDiscord | <hmmm> oh I think it's something like this var b : tuple[x:int,y:int] |
10:23:54 | * | mal`` joined #nim |
10:25:05 | * | junaid_ joined #nim |
10:35:20 | * | jmcantrell quit (Quit: Bridge terminating on SIGTERM) |
10:39:42 | * | jmcantrell joined #nim |
10:44:56 | PMunch | Yup, that's how you do it |
10:46:19 | * | junaid_ quit (Remote host closed the connection) |
10:46:32 | PMunch | You can also use this syntax for tuples without names: https://play.nim-lang.org/#ix=4gwL |
11:02:49 | FromDiscord | <hmmm> and how can I create a tuple of n elements at runtime |
11:08:15 | FromDiscord | <ChocolettePalette> Why do you need a tuple for that? Why not a list? |
11:10:10 | FromDiscord | <hmmm> that's an interesting question lol |
11:11:25 | FromDiscord | <hmmm> I think the main reason is that I'm using sortedbyit from algorithm that afaik works only for tuples |
11:14:00 | FromDiscord | <ChocolettePalette> You might need an array of tuples probablyWhat thing are you trying to implement? |
11:20:44 | FromDiscord | <hmmm> I have a table in the form of seq[seq[string] I want it ordered and at the moment I can have it ordered for 1 column by creating the relevant tuple and using sortingbyit, now I was trying to get the nested order on more columns and it's getting hairy lol |
11:23:15 | FromDiscord | <ChocolettePalette> Try using sortByIt but pass smth like it[0], it might work but I can't be sure |
11:23:35 | FromDiscord | <hmmm> I think the saner approach is making it a dataframe and use the dataframe facilities but wanted to see if I was able to do it manually |
11:33:39 | FromDiscord | <vindaar> @hmmm\: you can't construct an arbitrary (i.e. types determined at RT) tuple at runtime. the type information must be known at compile time |
11:34:37 | FromDiscord | <hmmm> yea vind I was thinking the same |
12:54:00 | * | jmdaemon quit (Ping timeout: 260 seconds) |
13:00:07 | * | genpaku quit (Read error: Connection reset by peer) |
13:00:47 | * | genpaku joined #nim |
13:20:13 | * | derpydoo joined #nim |
13:36:12 | NimEventer | New post on r/nim by Robert_Bobbinson: 2D Vectors in Nim's standard lib?, also getting index of iteration with 0..9 and countup, see https://reddit.com/r/nim/comments/z1tqqz/2d_vectors_in_nims_standard_lib_also_getting/ |
13:51:38 | * | lucerne quit (Ping timeout: 256 seconds) |
14:32:59 | * | kenran joined #nim |
14:33:00 | * | arkurious joined #nim |
14:35:02 | * | kenran quit (Remote host closed the connection) |
14:47:51 | * | PMunch quit (Quit: Leaving) |
14:55:40 | * | rockcavera joined #nim |
15:01:58 | FromDiscord | <albassort> Why would... |
15:02:17 | FromDiscord | <albassort> Do they mean vector in the sense of like C vectors |
15:32:12 | FromDiscord | <ali> Feeling a bit baffled, does nim only support exponentiation with ^ for positive interger bases and powers? Not float bases? |
15:36:51 | FromDiscord | <dlesnoff> https://nim-lang.org/docs/math.html#pow%2Cfloat32%2Cfloat32 |
15:38:34 | FromDiscord | <ali> sent a long message, see http://ix.io/4gyj |
15:38:48 | FromDiscord | <ali> required type of x is int? |
15:39:35 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4gyl |
15:40:17 | FromDiscord | <dlesnoff> I think he meant that the '^' symbol is not overloaded for float number too. |
15:40:34 | FromDiscord | <ali> works, I had imported pow from std/complex as I'm also using complex numbers↵(@Phil) |
15:40:37 | FromDiscord | <Phil> Ahhh.... that one's fairly possible, though luckily it is trivial to overload yourself |
15:41:33 | FromDiscord | <Phil> And yeah, skimming very roughly through the math docs it doesn't appear to be defined for non-ints |
15:41:40 | FromDiscord | <dlesnoff> I am wondering if there has not been a discussion on why the overload in the stdlib is not possible |
15:42:14 | FromDiscord | <dlesnoff> Something like no float64 in Javascript target ? |
15:43:30 | Amun-Ra | no uint64 for sure |
15:45:07 | Amun-Ra | (js has 52-bit integers, max) |
15:46:09 | FromDiscord | <dlesnoff> Ok but then it is unrelated to the `^` overloading |
15:47:17 | Amun-Ra | sorry, I sidetrack a lot |
15:47:20 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=4gym |
15:48:01 | FromDiscord | <hmmm> I want to use my Tees freely 🧐 |
15:48:13 | FromDiscord | <Rika> In reply to @hmmm "broskis is there a": Doesn’t make sense |
15:48:21 | FromDiscord | <Rika> What do you mean |
15:49:02 | FromDiscord | <hmmm> I want a to be a seq of whatever. And whatever gets decided later 🤡 |
15:49:47 | FromDiscord | <albassort> In reply to @Isofruit "Ahhh.... that one's fairly": We should PR this. I also think there's not enough overloads of other mathematical symbols |
15:50:01 | FromDiscord | <albassort> E.g / both sides must be float |
15:50:14 | FromDiscord | <albassort> Makes code a bit ugly |
15:50:32 | FromDiscord | <Rika> In reply to @hmmm "I want a to": You can use that in generics |
15:50:36 | FromDiscord | <Rika> Not elsewhere |
15:50:51 | FromDiscord | <hmmm> so only in procs? |
15:51:06 | FromDiscord | <dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4gyn |
15:51:19 | FromDiscord | <Rika> `proc name[T]... = var a: seq[T]` would be valid, yes |
15:51:24 | FromDiscord | <albassort> Yeah but y needs to be a natural number |
15:51:27 | FromDiscord | <albassort> It can't be .1 |
15:51:38 | FromDiscord | <albassort> Do it can't be float |
15:51:41 | FromDiscord | <hmmm> I see |
15:53:48 | FromDiscord | <ali> dunno if relevant but found this closed issue https://github.com/nim-lang/Nim/issues/2897 which suggested making ^ an alias for pow. |
15:54:33 | FromDiscord | <dlesnoff> In reply to @albassort "Do it can't be": It can. I just tried in Inim, nim 1.6.8, import std/math, 0.1^2 == 0.01 |
15:55:04 | FromDiscord | <albassort> Isn't ^ in system |
15:55:18 | FromDiscord | <albassort> In reply to @Jiezron "It can. I just": Also other way around |
15:55:24 | FromDiscord | <albassort> Not 0.1 ^ 2 |
15:55:30 | FromDiscord | <albassort> 2 ^ 0.1 |
15:55:49 | FromDiscord | <albassort> The second parameter needs to be natural not the first |
15:56:46 | FromDiscord | <Rika> In reply to @albassort "Isn't ^ in system": no |
15:56:55 | FromDiscord | <dlesnoff> Yeah that seems normal to me, in some sense. |
15:57:05 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=4gyq |
15:57:18 | FromDiscord | <albassort> There's reasons for this but pow accepts arbitrary in the exponential parameter if I recall correctly |
15:57:25 | FromDiscord | <albassort> And you imma take a shower nerds |
15:59:27 | FromDiscord | <dlesnoff> I don't know about float accuracy, can't you just do exp(powerlog(a, base)) to compute $a^power$ ? |
15:59:39 | FromDiscord | <Rika> the implementation of ^ requires y to be a natural because it uses bit shifts as a quick division by 2 for y |
16:01:54 | FromDiscord | <dlesnoff> No I am stupid, we could wrap powf for this: https://en.cppreference.com/w/c/numeric/math/pow |
16:02:35 | FromDiscord | <dlesnoff> In reply to @Rika "the implementation of ^": Couldn't it test the type of the second parameter and adapt the implementation from it ? |
16:03:02 | FromDiscord | <Rika> probably an archaism really |
16:03:09 | * | lucerne joined #nim |
16:10:47 | FromDiscord | <dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4gyz |
16:12:07 | FromDiscord | <dlesnoff> (edit) "https://play.nim-lang.org/#ix=4gyz" => "https://play.nim-lang.org/#ix=4gyA" |
16:12:16 | FromDiscord | <Phil> After reading the issue I have come to realize that exponentiation and how it works can be disgustingly unintuitive |
16:40:27 | * | LuxuryMode joined #nim |
16:43:11 | FromDiscord | <dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4gyI |
16:52:10 | FromDiscord | <dlesnoff> Finally made a PR for this `^` overload story: https://github.com/nim-lang/Nim/pull/20898 |
17:01:19 | * | pro joined #nim |
17:02:02 | * | pro left #nim (#nim) |
17:40:32 | FromDiscord | <albassort> What is the real reason that booleans can't be stored as bits? |
17:41:11 | FromDiscord | <albassort> Why don't we initiate a space in memory for groupings of eight booleans |
17:41:26 | FromDiscord | <albassort> Each boolean being a bit |
17:42:03 | FromDiscord | <albassort> For every eight booleans instantiated in the program, a new byte is allocated to this memory space |
17:43:10 | Amun-Ra | #1… speed |
17:43:35 | FromDiscord | <albassort> This is a memory optimization not a speed optimization but I don't see why it would be slower |
17:43:43 | FromDiscord | <albassort> Currently as it is we assign 8-bits to 1 or 0 |
17:43:51 | FromDiscord | <albassort> Would it not be faster in the long run to only assign one |
17:43:52 | Amun-Ra | if you're bound to memory limits don't use nim |
17:44:03 | FromDiscord | <albassort> This is also a thing in C++ |
17:44:27 | FromDiscord | <albassort> In reply to @Amun-Ra "if you're bound to": And also not an argument because Nim is both a speed optimized language and a memory optimized language |
17:44:28 | Amun-Ra | nim has its pragma for that |
17:44:58 | Amun-Ra | I don't like bitfields simple because bitfields are implementation defined |
17:45:18 | FromDiscord | <albassort> What do you mean by that |
17:45:23 | Amun-Ra | neither C not C++ defines bitfield strict memory layout |
17:45:51 | Amun-Ra | if you care about binary compatibility between different systems use bitmasks not bitfields |
17:46:13 | FromDiscord | <albassort> What are bitmasks |
17:46:36 | Amun-Ra | x = (x & 0xf0) | 0x80; |
17:46:55 | Amun-Ra | setting bits via and/or/xor |
17:46:57 | FromDiscord | <albassort> In reply to @Amun-Ra "neither C not C++": So it's a binary within a range for bytes |
17:47:05 | FromDiscord | <albassort> (edit) "for bytes" => "of a byte" |
17:47:13 | FromDiscord | <albassort> (edit) "binary" => "bit field" |
17:47:18 | FromDiscord | <albassort> Voice to text is really not helping me here |
17:47:25 | Amun-Ra | no, within a specific compiler on specific platform |
17:48:11 | FromDiscord | <albassort> Oh I googled it |
17:48:14 | FromDiscord | <albassort> Til the name for that |
17:48:30 | Amun-Ra | :> |
17:50:46 | FromDiscord | <dlesnoff> In reply to @Amun-Ra "neither C not C++": Is it just an endianness problem here ? |
17:51:16 | Amun-Ra | dlesnoff: no, the layout itself |
17:51:37 | FromDiscord | <albassort> It's a thing where the operations can be weird on different architectures I'm pretty sure |
17:51:52 | FromDiscord | <albassort> You can correct for endianness with a booleans |
17:51:59 | FromDiscord | <albassort> (edit) "booleans" => "boolean" |
17:52:10 | Amun-Ra | I mean the standard is very hmm… unspecified; IIRC gcc and clang use the same bit layout |
17:52:56 | FromDiscord | <Horizon [She/Her]> Isn't it fairly easy to implement something like what you're talking about Caroline? |
17:53:21 | FromDiscord | <albassort> Very easy kind of |
17:53:30 | FromDiscord | <albassort> But appears nim already has it |
17:53:30 | FromDiscord | <Horizon [She/Her]> There should be a way to check each bit in a byte, which an int8 would fit afaik |
17:53:36 | FromDiscord | <Horizon [She/Her]> In reply to @albassort "But appears nim already": Ah alright |
17:53:39 | FromDiscord | <albassort> There isn't actually |
17:53:43 | FromDiscord | <Horizon [She/Her]> Oh huh |
17:53:51 | Amun-Ra | I mean having one bit in one byte and the second bit in other byte is according to C specs |
17:54:04 | FromDiscord | <albassort> Accessing individual bytes in bit ops is annoying |
17:54:11 | FromDiscord | <Horizon [She/Her]> Rip |
17:54:42 | FromDiscord | <Horizon [She/Her]> In reply to @Amun-Ra "I mean having one": Fair enough |
17:54:47 | FromDiscord | <eventidegays> i spent an hour making a thing that transforms source files a bit because the lsp not working for it bothered me so much |
17:55:19 | FromDiscord | <albassort> I uses this library called biteqs |
17:55:33 | FromDiscord | <albassort> (edit) "biteqs" => "biseqs" |
17:55:39 | FromDiscord | <albassort> And while it works it's quite slow |
17:55:57 | FromDiscord | <albassort> Slower than string parsing |
17:56:05 | FromDiscord | <albassort> And I bet it's really memory inefficient too |
17:56:52 | FromDiscord | <Horizon [She/Her]> Rip |
17:57:04 | FromDiscord | <Horizon [She/Her]> How does biseq work/what is it's purpose? |
17:57:07 | FromDiscord | <ali> rarely does it matter (memory efficiency) |
17:57:43 | FromDiscord | <Horizon [She/Her]> In reply to @ali "rarely does it matter": Embedded systems is an example of where it matters |
17:58:16 | FromDiscord | <ali> I wrote a game of life to run in avr8 using bits exclusviely (most implementations use a byte per cell) fun, but unneccessary |
17:59:08 | FromDiscord | <Horizon [She/Her]> Fair lmao |
18:00:11 | Amun-Ra | I like doing stuff for fun |
18:00:36 | Amun-Ra | I have to finish my relay clock and ternary cpu someday ;> |
18:00:41 | FromDiscord | <ali> https://github.com/ali-raheem/conway/blob/master/conway.h all in a template 🤪 |
18:00:56 | FromDiscord | <ali> I'd love to have a relay clock↵(<@709044657232936960_=41mun-=52a=5b=49=52=43=5d>) |
18:01:04 | FromDiscord | <ali> relays \> nixie in clocks |
18:02:10 | Amun-Ra | that's the relay I chose for that: https://panda-bg.com/products/hi/hi-3640-271055-Relay-R15-3PDT-10A-12V-Poland.jpg |
18:02:22 | Amun-Ra | ali: yes, the clock uses nixies |
18:48:52 | * | junaid_ joined #nim |
19:05:59 | FromDiscord | <Yepoleb> In reply to @albassort "Would it not be": you can not assign single bits with a cpu. you need to shift the value to its place in the byte, bitwise-or it and write it back to memory. with full byte booleans this is not necessary, it can be written directly. |
19:06:44 | FromDiscord | <albassort> I'm sure you can with some architecture |
19:07:03 | FromDiscord | <albassort> I don't know how id google this question though |
19:07:37 | Amun-Ra | that'd have to be some 1-bit cpu |
19:08:10 | FromDiscord | <albassort> Yeah but 64-bit CPUs Don't work on six byte instructions |
19:08:17 | FromDiscord | <albassort> Unless they do |
19:08:34 | FromDiscord | <albassort> Do you mean 1 bit byte cpu |
19:08:36 | FromDiscord | <Yepoleb> there is no way to address a single bit, all our addresses refer to bytes |
19:09:07 | Amun-Ra | and very often operating on 32-bit atoms is faster than doing the same on 8-bit ones |
19:09:23 | FromDiscord | <albassort> Then... How does anything function? |
19:10:01 | FromDiscord | <albassort> If you can only assign bytes of 1 and 0s, how do you get any other combination |
19:10:40 | FromDiscord | <Yepoleb> you can assign any value to a byte |
19:10:47 | FromDiscord | <albassort> What instruction would create any arbitrary data from ↵00000000↵11111111 |
19:10:58 | FromDiscord | <albassort> Damn non monospace font |
19:11:24 | FromDiscord | <Yepoleb> you just always have to assign 8, 16, 32 or 64 bits at once |
19:11:45 | FromDiscord | <Yepoleb> with some architectures this is even more limited |
19:12:04 | FromDiscord | <albassort> In reply to @Yepoleb "you can assign any": So you assign a 16 bit integer then cleave out a 8bit value |
19:12:20 | FromDiscord | <albassort> Sound inefficient |
19:12:41 | Amun-Ra | inefficient in terms of? |
19:12:46 | FromDiscord | <albassort> But I know nothing about CPU architecture |
19:13:12 | FromDiscord | <Yepoleb> In reply to @albassort "So you assign a": i don't understand |
19:13:24 | FromDiscord | <albassort> In reply to @Amun-Ra "inefficient in terms of?": You're saying that because we can't assign individual bytes |
19:13:32 | FromDiscord | <albassort> Wrong reply |
19:13:48 | Amun-Ra | you can't read a single bit from memory, you have to read at least one byte; there are some cpu architectures that can't ready a byte and have to read at least 32 bits |
19:14:03 | FromDiscord | <albassort> We can assign a byte of 00000000 and 11111111 and then logically create any arbitrary value |
19:14:05 | FromDiscord | <albassort> That's how I interpret it |
19:14:29 | Amun-Ra | you read a byte, modify a bit, write a byte; that's how it goes |
19:14:42 | FromDiscord | <albassort> In reply to @Amun-Ra "you read a byte,": OH |
19:15:01 | FromDiscord | <albassort> I thought they meant that you can't read or write a byte |
19:15:32 | FromDiscord | <albassort> I was confused on how anything would work at all if you can't write bytes individually |
19:16:06 | FromDiscord | <Yepoleb> bytes yes, bits no |
19:16:14 | FromDiscord | <albassort> AHH |
19:16:23 | FromDiscord | <albassort> (edit) "byte" => "bits" |
19:16:31 | FromDiscord | <albassort> (edit) "bytes" => "bits" |
19:16:33 | FromDiscord | <albassort> I hate typing on a phone |
19:17:48 | FromDiscord | <Yepoleb> to set the third bit (counting from 0) in a variable you have to do `x = x or (1 shl 3)` |
19:20:52 | FromDiscord | <albassort> I understand what's happening now dw |
19:33:48 | FromDiscord | <albassort> Is there any way to switch between let and const |
19:33:55 | FromDiscord | <albassort> Like do I need a macro to do that. |
19:34:11 | FromDiscord | <albassort> I want there to be a compiler option where all of my lets that can be const are made into const |
19:35:49 | FromDiscord | <guttural666> what is de way to define an int type to only accept values from 1 to 10? |
19:38:15 | FromDiscord | <ali> to what end?↵(@albassort) |
19:42:50 | * | junaid_ quit (Remote host closed the connection) |
19:44:55 | FromDiscord | <albassort> In reply to @ali "to what end? (<@217459674700578816>)": Statically linking |
19:46:50 | FromDiscord | <ali> I find it hard to imagine a scenario where I'd not want a value to be in the data section, are you doing embedded work? |
19:55:17 | FromDiscord | <albassort> I want my program to work as statically as possible |
19:55:52 | * | pro joined #nim |
19:56:12 | * | pro left #nim (#nim) |
19:56:25 | FromDiscord | <GalacticColourisation> In reply to @.tochka "i dont get your": thhis reply and ↵> Well to be fair i made what might be considered a effect system in like 40 lines of code↵Elegantbeef: thank you very much for pointing me to the rfc repository, after discussing it, it seems to have been accepted: https://github.com/nim-lang/RFCs/issues/491 |
19:56:27 | FromDiscord | <ali> I'll let someone who knows nim better answer. But this kind of thing is top of the list of "not a programmer problem" for me. |
19:57:09 | FromDiscord | <GalacticColourisation> (for what it's worth, elegantbeef, wat you ahd i woulldn't consider an effect system either ) |
20:09:25 | FromDiscord | <guttural666> the compiler doesn't seem to be able to distinguish between the name for a type and a variable, which seem stupid on the surface? https://media.discordapp.net/attachments/371759389889003532/1044706185498066974/image.png |
20:09:50 | * | xet7 joined #nim |
20:09:56 | FromDiscord | <hotdog> In reply to @guttural666 "the compiler doesn't seem": Convention is to uppercase first letter for types |
20:10:33 | FromDiscord | <EyeCon> In reply to @guttural666 "the compiler doesn't seem": You expect to be able to name types and variables the same? 🤔 |
20:15:32 | FromDiscord | <ratapenado> Hello, if I have an array A of objects B and if B.x exists, is it possible to do something like A[0].x= 1 ? |
20:16:48 | FromDiscord | <EyeCon> In reply to @ratapenado "Hello, if I": Yes, although "array" in Nim sense is fixed-size (size known at compile time), sequences (dynamic ones) are suitable for more use cases |
20:17:11 | FromDiscord | <EyeCon> http://nim-lang.github.io/Nim/manual.html#types-array-and-sequence-types |
20:19:18 | FromDiscord | <ratapenado> Thank you. The number of objects is known at compile time |
20:21:23 | FromDiscord | <dlesnoff> In reply to @GalacticColourisation "thhis reply and ": This was a very interesting RFC ! I should dive in the cited papers one day. I don't have understood the difference, but I guess I have much to learn before understanding these theoretical aspects.↵I guess the term "effect tracking" help me to have at least an idea of what is wrong in Nim pseudo-effect system. |
20:21:54 | FromDiscord | <GalacticColourisation> there isnt much wrong with that |
20:22:30 | FromDiscord | <GalacticColourisation> its just calling it "effect system" is misleading |
20:23:04 | FromDiscord | <GalacticColourisation> i think the implementation that nim has right now is still interesting, it might be useful for a lot of things, along with emulating effect tracking |
20:28:29 | FromDiscord | <dlesnoff> From what I understand from your conversation, what is used to track effects can not be called effect handlers, and is not considered as potential source of effects. |
20:30:17 | FromDiscord | <guttural666> In reply to @EyeCon "You expect to be": yes, because the compiler should be smarter than me |
20:30:41 | FromDiscord | <guttural666> In reply to @hotdog "Convention is to uppercase": thought Nim was case insensitive? 😛 |
20:31:53 | FromDiscord | <hotdog> In reply to @guttural666 "thought Nim was case": Case insensitive except for the first letter, for this exact reason (differentiating types and variables of the same name) |
20:32:10 | FromDiscord | <guttural666> In reply to @hotdog "Case insensitive except for": ahhhhh, very nice, wasn't aware, thanks! |
20:32:53 | FromDiscord | <hotdog> In reply to @guttural666 "yes, because the compiler": In the case of “var variableName: typeName = value” it is obvious, but if you passed the name to e.g a template or macro, the compiler wouldn’t know which you meant |
20:33:08 | FromDiscord | <hotdog> In reply to @guttural666 "ahhhhh, very nice, wasn't": No worries |
20:33:23 | FromDiscord | <guttural666> yeh yeh, right, thanks! |
20:33:33 | FromDiscord | <ali> @albassort\: I've been thinking about what you asked and realised maybe I'd got the wrong end of the stick. Did you mean you wanted a compiler warning where there is a non const variable that could be calculated as compile time and is not changed? |
20:33:37 | FromDiscord | <hotdog> It seems quirky coming from other languages, but in practice it works nicely and makes sense |
20:35:17 | FromDiscord | <guttural666> In reply to @hotdog "It seems quirky coming": types like MainWindow and variables like mainwindow or mainwindow_, that is pretty familiar from c++ et al |
20:35:50 | FromDiscord | <albassort> In reply to @ali "I'll let someone who": I don't know what this means |
20:36:31 | FromDiscord | <albassort> In reply to @ali "<@217459674700578816>\: I've been thinking": I want to compiler to compile everything as statically as possible when given a certain argument. Otherwise assign it at runtime with let. |
20:37:19 | FromDiscord | <albassort> I don't think this is a thing in the compiler, but I think it could be a thing because the system's understands const and let the same |
20:40:33 | FromDiscord | <hotdog> In reply to @guttural666 "types like MainWindow and": I meant the case insensitivity seeming quirky |
20:40:36 | FromDiscord | <ali> Ah that's what I thought you were asking. Yeah that shouldn't be your problem. The compiler should optimize as best it can.↵(@albassort) |
20:41:37 | FromDiscord | <albassort> In reply to @ali "Ah that's what I": Yeah then why have the option to have const in general then |
20:41:42 | FromDiscord | <albassort> Doesn't make any sense |
20:42:07 | FromDiscord | <ali> It does because it tells people and the compiler what you expect. |
20:42:17 | FromDiscord | <albassort> You know what I mean |
20:42:21 | FromDiscord | <ali> If you use const and it doesn't work compiler will let you know |
20:42:51 | FromDiscord | <dlesnoff> but not the other way around |
20:43:13 | FromDiscord | <dlesnoff> because it can't |
20:43:43 | FromDiscord | <ali> tenor\_gif7750227432097982833.gif https://media.discordapp.net/attachments/371759389889003532/1044714817954529390/tenor_gif7750227432097982833.gif |
20:43:43 | FromDiscord | <dlesnoff> It can not guess that a `let` variable will only be used at CT |
20:43:53 | FromDiscord | <ali> If it's anything like constexpr ? |
20:45:17 | FromDiscord | <ali> GCC does sometimes without constexpr anyways↵(@dlesnoff) |
20:48:05 | FromDiscord | <dlesnoff> If your variable is exported, a `let` can be either `const` or `let` depending on users of the static lib. |
20:55:47 | * | pech quit (Quit: Leaving) |
21:14:36 | FromDiscord | <guttural666> In reply to @hotdog "I meant the case": thanks again for the hint, my code already confuses me less, camel casing the types (FlagSet) and snake casing (flag_set: FlagSet) the variables now (think those are the terms) 🙂 |
21:15:20 | FromDiscord | <guttural666> vim global replace to the rescue |
21:19:19 | FromDiscord | <hotdog> In reply to @guttural666 "thanks again for the": Good to hear! You are free to use whichever casing you like, but if you do want to follow general Nim convention there is a style guide here - https://nim-lang.org/docs/nep1.html |
21:23:19 | FromDiscord | <guttural666> In reply to @hotdog "Good to hear! You": you know if there is a clang format? I use it for c++ in vim, it's pretty cool, you can configure a bunch of styles and pretty print your code automatically |
21:24:12 | FromDiscord | <hotdog> In reply to @guttural666 "you know if there": There are two that I know of - https://github.com/nim-lang/Nim/tree/devel/nimpretty https://github.com/FedericoCeratto/nimfmt |
21:24:32 | FromDiscord | <hotdog> Haven't used them though, and I've heard they are not as advanced as similar tools for other languages |
21:25:26 | FromDiscord | <guttural666> In reply to @hotdog "There are two that": thanks, gonna check that out, I bound the pretty print whole file command to :w in vim, which auto pretty prints on each save, which is amazing 🙂 |
21:25:27 | FromDiscord | <Tuatarian> How do I add a `Bracket` node to a `Prefix`? |
21:25:49 | FromDiscord | <Tuatarian> `newNode` gives some error saying it's an illegal statement in a macro |
21:27:08 | FromDiscord | <guttural666> In reply to @hotdog "Good to hear! You": that Nim style guide is really helpful, especially when you're new |
21:28:20 | FromDiscord | <hotdog> In reply to @guttural666 "thanks, gonna check that": That's neat. I use the auto-formatting stuff for C# a fair bit, don't know why I've never really tried it for Nim |
21:28:35 | FromDiscord | <hotdog> In reply to @iWonderAboutTuatara "`newNode` gives some error": Can you paste code example? |
21:40:09 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
21:44:10 | FromDiscord | <Tuatarian> Trying to generate `@["1","2"]` in a macro |
21:44:36 | FromDiscord | <Tuatarian> On my phone, I'll be home and paste in ~15m |
21:44:38 | FromDiscord | <Tuatarian> Sorry |
21:45:04 | FromDiscord | <Tuatarian> In reply to @iWonderAboutTuatara "`newNode` gives some error": Saying nnkBracketExpr is illegal in a macro |
21:45:54 | FromDiscord | <Elegantbeef> You really dont↵(@albassort) |
21:46:13 | FromDiscord | <guttural666> In reply to @iWonderAboutTuatara "Saying nnkBracketExpr is illegal": you could use the dumptree thing/marco to dump the macro that you need to generate expression XY |
21:46:18 | FromDiscord | <guttural666> seen this in a talk lately |
21:46:24 | FromDiscord | <Elegantbeef> tuatara it's `newCall("@", nnkBracketExpr.newTree(newLit"1", newLit"2"))` |
21:47:09 | FromDiscord | <guttural666> there is a thing that kinda dumps the AST that one needs to generate code abc in nim, can't remember exactly |
21:47:22 | FromDiscord | <Elegantbeef> `astGenRepr`? |
21:47:32 | FromDiscord | <hotdog> Yeah or `dumpAstGen` |
21:47:54 | FromDiscord | <guttural666> In reply to @hotdog "Yeah or `dumpAstGen`": think that was it, the Bulgarian dude had it in one of his talks |
21:48:15 | FromDiscord | <hotdog> sent a code paste, see https://play.nim-lang.org/#ix=4gAd |
21:53:02 | FromDiscord | <guttural666> sent a long message, see http://ix.io/4gAf |
21:53:06 | FromDiscord | <albassort> In reply to @Elegantbeef "You really dont (<@217459674700578816>)": Why not nerd |
21:53:19 | FromDiscord | <Elegantbeef> Cause it makes the code harder to reason about |
21:53:24 | FromDiscord | <Elegantbeef> What's on the heap and what's not |
21:53:33 | FromDiscord | <Elegantbeef> Where am i doing work and where am i not |
21:53:42 | FromDiscord | <albassort> I guess that's true as hell |
21:53:50 | FromDiscord | <albassort> I guess my make alternative will never happen |
22:05:13 | FromDiscord | <albassort> @ElegantBeef so, i have a question about optimizing for functional programming. Is there a technical limitation thats stopping people from working on it, or is there just nobody pouring time into it? |
22:05:59 | FromDiscord | <Elegantbeef> I'd say there is a technical limitation how the fact Nim iterators are either inline or closure so you cannot chain them |
22:06:13 | FromDiscord | <Elegantbeef> You have things like zero-functional though |
22:06:47 | FromDiscord | <albassort> In reply to @Elegantbeef "I'd say there is": so implementing ghc inspired code would be a pain in the ass i presume |
22:07:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gAl |
22:08:01 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4gAm |
22:08:07 | FromDiscord | <albassort> and less memory intensive |
22:08:15 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gAn |
22:08:22 | FromDiscord | <Elegantbeef> It's the same |
22:08:38 | FromDiscord | <Elegantbeef> I dont use lambda procs |
22:08:40 | FromDiscord | <albassort> In reply to @Elegantbeef "You need to rewrite": which is pretty slow |
22:08:55 | FromDiscord | <Elegantbeef> no it's not |
22:08:58 | FromDiscord | <Elegantbeef> It's fast |
22:08:59 | FromDiscord | <albassort> how does ghc do this stuff? |
22:09:17 | FromDiscord | <Elegantbeef> Partial evaluation and intelligent iterators |
22:09:18 | FromDiscord | <albassort> if it is then why do you yell at me when i do a whole bunch of functional code |
22:09:20 | FromDiscord | <Elegantbeef> Like i just described |
22:09:33 | FromDiscord | <Elegantbeef> Cause the for loop is fast when you use sequtils it's not |
22:12:07 | FromDiscord | <albassort> In reply to @Elegantbeef "Cause the for loop": ok so we need to optimize sequtil |
22:12:10 | FromDiscord | <albassort> (edit) "sequtil" => "sequtils" |
22:12:52 | FromDiscord | <Elegantbeef> You cannot |
22:13:16 | FromDiscord | <&Makarov/1> sent a code paste, see https://paste.rs/0t7 |
22:13:18 | FromDiscord | <&Makarov/1> https://media.discordapp.net/attachments/371759389889003532/1044737363986890772/image.png |
22:13:22 | FromDiscord | <Elegantbeef> There is no way of doing `myArbitraryIterator.map(myProc).filter(myProc)` |
22:13:25 | FromDiscord | <Elegantbeef> It's just impossible |
22:13:36 | FromDiscord | <&Makarov/1> https://media.discordapp.net/attachments/371759389889003532/1044737440423874725/image.png |
22:13:40 | FromDiscord | <albassort> then how do ghc be fast |
22:13:44 | FromDiscord | <albassort> wouldn't ghc be slow as fuck |
22:13:47 | FromDiscord | <Elegantbeef> ... |
22:13:52 | FromDiscord | <Elegantbeef> There is no way in Nim |
22:14:00 | FromDiscord | <albassort> well, why not |
22:14:23 | FromDiscord | <albassort> I know im being a little kid asking mommy "WHY IS THE SKY BLUE" |
22:14:26 | FromDiscord | <Elegantbeef> Do you only read parts of the messages |
22:15:00 | FromDiscord | <albassort> In reply to @Elegantbeef "I'd say there is": well yes, but, why not make a third implementation |
22:15:13 | FromDiscord | <Elegantbeef> Cause that requires compiler work? |
22:15:29 | FromDiscord | <albassort> why don't we do that |
22:15:40 | FromDiscord | <albassort> is it the fact that its effort |
22:15:42 | FromDiscord | <Elegantbeef> .... no clue why dont you? |
22:15:43 | FromDiscord | <albassort> or is it a technical thing |
22:15:44 | FromDiscord | <Elegantbeef> All features start unimplemented |
22:16:20 | FromDiscord | <albassort> In reply to @Elegantbeef ".... no clue why": I feel like I'd spend months working on my PR then getting it rejected and being sad |
22:16:29 | FromDiscord | <Elegantbeef> None of those fields are exported↵(@&Makarov/1) |
22:17:09 | FromDiscord | <&Makarov/1> In reply to @Elegantbeef "None of those fields": thanks for the reply , so if i get it right , i'm not supposed to alter them right ? |
22:17:19 | FromDiscord | <Elegantbeef> Well.... i mean i dont know whatelse i can really say. The nim compiler does not presently support a way to chain iterators then optimise them |
22:17:19 | FromDiscord | <Elegantbeef> Correct you're not |
22:17:56 | FromDiscord | <Elegantbeef> The best we can really do with present nim is https://github.com/beef331/slicerator/blob/master/tests/tchain.nim |
22:18:26 | * | jmdaemon joined #nim |
22:18:46 | FromDiscord | <albassort> I have been wanting like megazip |
22:18:58 | FromDiscord | <albassort> where you can just chain arbitrary number of iterators |
22:19:15 | FromDiscord | <Elegantbeef> I mean you can chain arbitrary number of iterators |
22:19:30 | FromDiscord | <Elegantbeef> The issue there is they have to be closures |
22:19:53 | FromDiscord | <albassort> closures are lame |
22:20:03 | FromDiscord | <albassort> until they're not |
22:20:04 | FromDiscord | <Elegantbeef> Which means they're slower than the inline counterpart |
22:20:07 | FromDiscord | <Elegantbeef> Closures arent really lame |
22:20:20 | FromDiscord | <albassort> in this usecase there is |
22:20:27 | FromDiscord | <albassort> (edit) "there is" => "they are" |
22:20:32 | FromDiscord | <Elegantbeef> Closures are first class, which is fantastic |
22:20:32 | FromDiscord | <Elegantbeef> Except for the whole part where the compiler does not inline them where they can |
22:21:50 | * | pbotfullerton joined #nim |
22:22:28 | FromDiscord | <Elegantbeef> In theory one could inline a closure based of a criteria |
22:23:04 | FromDiscord | <Elegantbeef> So then like `for x in mySeq.items.map(mapProc).filter(filterProc): ...` could be nearly as fast as the inline implementation |
22:31:02 | pbotfullerton | Hello, does the standard library have any sort of BufferedStream that doesn't use a syscall for every character? I'm running into performance issues with reading a file line by line using the `lines` iterator |
22:32:53 | FromDiscord | <Elegantbeef> I really should make a PR to replace the present `lines` iterator. https://play.nim-lang.org/#ix=40gN is as the name implies faster |
22:45:44 | FromDiscord | <arkanoid> Test matrix test |
22:45:50 | arkanoid | Yeah! |
22:51:40 | FromDiscord | <arkanoid> So far I've always been using async instead of threading, as I find my programs being io bound most of the times. I wonder what am I missing there in the threading world |
22:52:29 | FromDiscord | <Elegantbeef> Depends on what you're doing simd, might be more approachable to threading |
22:54:06 | FromDiscord | <arkanoid> Also I've never used simd |
22:54:27 | FromDiscord | <Elegantbeef> It's a specialised tool so really depends what you are doing \:d |
22:54:36 | FromDiscord | <arkanoid> I should really quit my comfort zone and explore something new like that |
22:56:47 | FromDiscord | <arkanoid> Well, so far I've been staying on python for anything related to science, but I'm slowly replacing some python modules with nimpy modules for things that I want to run faster |
22:56:53 | * | LyndsySimon_ joined #nim |
22:57:19 | * | mal``` joined #nim |
22:57:39 | FromDiscord | <ali> What's nimpy? Numpy? |
22:58:34 | * | oprypin_ joined #nim |
22:59:08 | FromDiscord | <ali> Is OpenMP still a thing? That's pretty cool and often nearly free so long as you keep it in mind as you write |
22:59:13 | FromDiscord | <arkanoid> Nope, nimpy. It enables you to interface with python with just a pragma and some command line options |
22:59:16 | * | madprog_ joined #nim |
22:59:27 | FromDiscord | <ali> Very cool |
23:00:04 | FromDiscord | <arkanoid> It more than very cool. It's super cool. It puts cython to shame |
23:03:10 | FromDiscord | <arkanoid> Basically I'm taking existing python modules (when signature makes it possible) and rewrite them 1\:1 with nim and export them as native modules. I don't even have to rewrite pytest cases! |
23:04:04 | FromDiscord | <ali> That's really sweet. I think once or twice I wrote modules in c and it was a PITA |
23:04:34 | * | mal`` quit (*.net *.split) |
23:04:34 | * | LyndsySimon quit (*.net *.split) |
23:04:34 | * | oprypin quit (*.net *.split) |
23:04:34 | * | nisstyre quit (*.net *.split) |
23:04:34 | * | deadmarshal quit (*.net *.split) |
23:04:34 | * | joast quit (*.net *.split) |
23:04:34 | * | madprog quit (*.net *.split) |
23:04:34 | * | Amun-Ra quit (*.net *.split) |
23:04:35 | * | LyndsySimon_ is now known as LyndsySimon |
23:05:10 | FromDiscord | <arkanoid> Yes it is. I also went the router C (I feel brave) to cython (ugly but works) to nim (I don't want to use python anymore) |
23:05:36 | pbotfullerton | Wait did the lines iterator get updated recently? I distinctly remember reading through the docs that one of them had a comment of "inefficient, do not use in performance sensitive code" |
23:06:45 | FromDiscord | <Elegantbeef> Dont think so |
23:08:13 | * | deadmarshal joined #nim |
23:11:16 | * | Amun-Ra joined #nim |
23:12:02 | * | nisstyre joined #nim |
23:12:24 | FromDiscord | <arkanoid> Why should be Iterators not efficient out of the box? In me head, ot depends on what you are iterating on. Could be generating things on the fly |
23:15:49 | FromDiscord | <Elegantbeef> The built in Nim lines iterator uses some complex code that's hard to reason |
23:15:49 | FromDiscord | <Elegantbeef> That's my argument for why it's slow |
23:19:55 | FromDiscord | <auxym> I wonder why it needs to be so complex. consume bytes until newline -> return bytes |
23:25:02 | FromDiscord | <Elegantbeef> Well that's what mine does |
23:25:03 | FromDiscord | <Elegantbeef> Read data in 128 byte chunks copy up until a new line yield string |
23:25:03 | FromDiscord | <arkanoid> So "for x in @[1,2,3]\: ..." is slower looping over it using index 1,2,3? |
23:25:03 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/system/io.nim#L376-L495 suffice to say it's slow |
23:25:05 | FromDiscord | <Elegantbeef> No that's the same ark |
23:25:09 | FromDiscord | <Elegantbeef> The reason the iterator is slow is cause it depends on slow code |
23:25:13 | FromDiscord | <Elegantbeef> Iterators are supposed to be as fast as manually written loops, but if you depend on slow code it's slow |
23:25:22 | FromDiscord | <Elegantbeef> The code at the link i provided is the afformentioned slow code |
23:25:24 | FromDiscord | <Elegantbeef> The readline implemented is so complex i dont get why it's so complicated |
23:26:47 | pbotfullerton | Half of it looks like tty processing, the other half tries to use fgets (which is good) but gets bogged down dealing with long lines |
23:31:43 | pbotfullerton | Maybe it should be using getline instead? |
23:37:22 | FromDiscord | <GalacticColourisation> In reply to @Jiezron "From what I understand": correct |
23:43:10 | * | derpydoo quit (Ping timeout: 268 seconds) |