<< 22-11-2022 >>

00:29:50*lucerne joined #nim
01:34:01*derpydoo joined #nim
01:44:52NimEventerNew 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:18FromDiscord<ChocolettePalette> sent a code paste, see https://play.nim-lang.org/#ix=4gvh
02:19:57FromDiscord<Elegantbeef> No they want `a & b`
02:35:55FromDiscord<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:14FromDiscord<KatrinaKitten> sent a code paste, see https://play.nim-lang.org/#ix=4gvX
07:37:38FromDiscord<Elegantbeef> `astToStr` also look at `unittest.check`
07:40:09FromDiscord<KatrinaKitten> I'm aware of `unittest`, the example is purposely silly 🙂
07:40:34FromDiscord<Elegantbeef> I was telling to look at `check` cause it does exactly what you want
07:41:49FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/KFu
07:52:50*PMunch joined #nim
07:56:10FromDiscord<KatrinaKitten> Thanks, not quite what I needed but it put me on the right track and it works now
09:16:50FromDiscord<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:56FromDiscord<ratapenado> (on windows btw)
09:17:15FromDiscord<Elegantbeef> Expected
09:17:35FromDiscord<Elegantbeef> `-` is not a valid in an identifier in Nim and all module names need to be valid identifiers
09:28:40FromDiscord<ratapenado> Ok thanks !
09:39:49NimEventerNew 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:51FromDiscord<hmmm> broskis what's the way of declaring a tuple similar to this for seqs: var a: seq[int]
10:15:31FromDiscord<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:56PMunchYup, that's how you do it
10:46:19*junaid_ quit (Remote host closed the connection)
10:46:32PMunchYou can also use this syntax for tuples without names: https://play.nim-lang.org/#ix=4gwL
11:02:49FromDiscord<hmmm> and how can I create a tuple of n elements at runtime
11:08:15FromDiscord<ChocolettePalette> Why do you need a tuple for that? Why not a list?
11:10:10FromDiscord<hmmm> that's an interesting question lol
11:11:25FromDiscord<hmmm> I think the main reason is that I'm using sortedbyit from algorithm that afaik works only for tuples
11:14:00FromDiscord<ChocolettePalette> You might need an array of tuples probablyWhat thing are you trying to implement?
11:20:44FromDiscord<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:15FromDiscord<ChocolettePalette> Try using sortByIt but pass smth like it[0], it might work but I can't be sure
11:23:35FromDiscord<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:39FromDiscord<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:37FromDiscord<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:12NimEventerNew 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:58FromDiscord<albassort> Why would...
15:02:17FromDiscord<albassort> Do they mean vector in the sense of like C vectors
15:32:12FromDiscord<ali> Feeling a bit baffled, does nim only support exponentiation with ^ for positive interger bases and powers? Not float bases?
15:36:51FromDiscord<dlesnoff> https://nim-lang.org/docs/math.html#pow%2Cfloat32%2Cfloat32
15:38:34FromDiscord<ali> sent a long message, see http://ix.io/4gyj
15:38:48FromDiscord<ali> required type of x is int?
15:39:35FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4gyl
15:40:17FromDiscord<dlesnoff> I think he meant that the '^' symbol is not overloaded for float number too.
15:40:34FromDiscord<ali> works, I had imported pow from std/complex as I'm also using complex numbers↵(@Phil)
15:40:37FromDiscord<Phil> Ahhh.... that one's fairly possible, though luckily it is trivial to overload yourself
15:41:33FromDiscord<Phil> And yeah, skimming very roughly through the math docs it doesn't appear to be defined for non-ints
15:41:40FromDiscord<dlesnoff> I am wondering if there has not been a discussion on why the overload in the stdlib is not possible
15:42:14FromDiscord<dlesnoff> Something like no float64 in Javascript target ?
15:43:30Amun-Rano uint64 for sure
15:45:07Amun-Ra(js has 52-bit integers, max)
15:46:09FromDiscord<dlesnoff> Ok but then it is unrelated to the `^` overloading
15:47:17Amun-Rasorry, I sidetrack a lot
15:47:20FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=4gym
15:48:01FromDiscord<hmmm> I want to use my Tees freely 🧐
15:48:13FromDiscord<Rika> In reply to @hmmm "broskis is there a": Doesn’t make sense
15:48:21FromDiscord<Rika> What do you mean
15:49:02FromDiscord<hmmm> I want a to be a seq of whatever. And whatever gets decided later 🤡
15:49:47FromDiscord<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:01FromDiscord<albassort> E.g / both sides must be float
15:50:14FromDiscord<albassort> Makes code a bit ugly
15:50:32FromDiscord<Rika> In reply to @hmmm "I want a to": You can use that in generics
15:50:36FromDiscord<Rika> Not elsewhere
15:50:51FromDiscord<hmmm> so only in procs?
15:51:06FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4gyn
15:51:19FromDiscord<Rika> `proc name[T]... = var a: seq[T]` would be valid, yes
15:51:24FromDiscord<albassort> Yeah but y needs to be a natural number
15:51:27FromDiscord<albassort> It can't be .1
15:51:38FromDiscord<albassort> Do it can't be float
15:51:41FromDiscord<hmmm> I see
15:53:48FromDiscord<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:33FromDiscord<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:04FromDiscord<albassort> Isn't ^ in system
15:55:18FromDiscord<albassort> In reply to @Jiezron "It can. I just": Also other way around
15:55:24FromDiscord<albassort> Not 0.1 ^ 2
15:55:30FromDiscord<albassort> 2 ^ 0.1
15:55:49FromDiscord<albassort> The second parameter needs to be natural not the first
15:56:46FromDiscord<Rika> In reply to @albassort "Isn't ^ in system": no
15:56:55FromDiscord<dlesnoff> Yeah that seems normal to me, in some sense.
15:57:05FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=4gyq
15:57:18FromDiscord<albassort> There's reasons for this but pow accepts arbitrary in the exponential parameter if I recall correctly
15:57:25FromDiscord<albassort> And you imma take a shower nerds
15:59:27FromDiscord<dlesnoff> I don't know about float accuracy, can't you just do exp(powerlog(a, base)) to compute $a^power$ ?
15:59:39FromDiscord<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:54FromDiscord<dlesnoff> No I am stupid, we could wrap powf for this: https://en.cppreference.com/w/c/numeric/math/pow
16:02:35FromDiscord<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:02FromDiscord<Rika> probably an archaism really
16:03:09*lucerne joined #nim
16:10:47FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4gyz
16:12:07FromDiscord<dlesnoff> (edit) "https://play.nim-lang.org/#ix=4gyz" => "https://play.nim-lang.org/#ix=4gyA"
16:12:16FromDiscord<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:11FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4gyI
16:52:10FromDiscord<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:32FromDiscord<albassort> What is the real reason that booleans can't be stored as bits?
17:41:11FromDiscord<albassort> Why don't we initiate a space in memory for groupings of eight booleans
17:41:26FromDiscord<albassort> Each boolean being a bit
17:42:03FromDiscord<albassort> For every eight booleans instantiated in the program, a new byte is allocated to this memory space
17:43:10Amun-Ra#1… speed
17:43:35FromDiscord<albassort> This is a memory optimization not a speed optimization but I don't see why it would be slower
17:43:43FromDiscord<albassort> Currently as it is we assign 8-bits to 1 or 0
17:43:51FromDiscord<albassort> Would it not be faster in the long run to only assign one
17:43:52Amun-Raif you're bound to memory limits don't use nim
17:44:03FromDiscord<albassort> This is also a thing in C++
17:44:27FromDiscord<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:28Amun-Ranim has its pragma for that
17:44:58Amun-RaI don't like bitfields simple because bitfields are implementation defined
17:45:18FromDiscord<albassort> What do you mean by that
17:45:23Amun-Raneither C not C++ defines bitfield strict memory layout
17:45:51Amun-Raif you care about binary compatibility between different systems use bitmasks not bitfields
17:46:13FromDiscord<albassort> What are bitmasks
17:46:36Amun-Rax = (x & 0xf0) | 0x80;
17:46:55Amun-Rasetting bits via and/or/xor
17:46:57FromDiscord<albassort> In reply to @Amun-Ra "neither C not C++": So it's a binary within a range for bytes
17:47:05FromDiscord<albassort> (edit) "for bytes" => "of a byte"
17:47:13FromDiscord<albassort> (edit) "binary" => "bit field"
17:47:18FromDiscord<albassort> Voice to text is really not helping me here
17:47:25Amun-Rano, within a specific compiler on specific platform
17:48:11FromDiscord<albassort> Oh I googled it
17:48:14FromDiscord<albassort> Til the name for that
17:48:30Amun-Ra:>
17:50:46FromDiscord<dlesnoff> In reply to @Amun-Ra "neither C not C++": Is it just an endianness problem here ?
17:51:16Amun-Radlesnoff: no, the layout itself
17:51:37FromDiscord<albassort> It's a thing where the operations can be weird on different architectures I'm pretty sure
17:51:52FromDiscord<albassort> You can correct for endianness with a booleans
17:51:59FromDiscord<albassort> (edit) "booleans" => "boolean"
17:52:10Amun-RaI mean the standard is very hmm… unspecified; IIRC gcc and clang use the same bit layout
17:52:56FromDiscord<Horizon [She/Her]> Isn't it fairly easy to implement something like what you're talking about Caroline?
17:53:21FromDiscord<albassort> Very easy kind of
17:53:30FromDiscord<albassort> But appears nim already has it
17:53:30FromDiscord<Horizon [She/Her]> There should be a way to check each bit in a byte, which an int8 would fit afaik
17:53:36FromDiscord<Horizon [She/Her]> In reply to @albassort "But appears nim already": Ah alright
17:53:39FromDiscord<albassort> There isn't actually
17:53:43FromDiscord<Horizon [She/Her]> Oh huh
17:53:51Amun-RaI mean having one bit in one byte and the second bit in other byte is according to C specs
17:54:04FromDiscord<albassort> Accessing individual bytes in bit ops is annoying
17:54:11FromDiscord<Horizon [She/Her]> Rip
17:54:42FromDiscord<Horizon [She/Her]> In reply to @Amun-Ra "I mean having one": Fair enough
17:54:47FromDiscord<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:19FromDiscord<albassort> I uses this library called biteqs
17:55:33FromDiscord<albassort> (edit) "biteqs" => "biseqs"
17:55:39FromDiscord<albassort> And while it works it's quite slow
17:55:57FromDiscord<albassort> Slower than string parsing
17:56:05FromDiscord<albassort> And I bet it's really memory inefficient too
17:56:52FromDiscord<Horizon [She/Her]> Rip
17:57:04FromDiscord<Horizon [She/Her]> How does biseq work/what is it's purpose?
17:57:07FromDiscord<ali> rarely does it matter (memory efficiency)
17:57:43FromDiscord<Horizon [She/Her]> In reply to @ali "rarely does it matter": Embedded systems is an example of where it matters
17:58:16FromDiscord<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:08FromDiscord<Horizon [She/Her]> Fair lmao
18:00:11Amun-RaI like doing stuff for fun
18:00:36Amun-RaI have to finish my relay clock and ternary cpu someday ;>
18:00:41FromDiscord<ali> https://github.com/ali-raheem/conway/blob/master/conway.h all in a template 🤪
18:00:56FromDiscord<ali> I'd love to have a relay clock↵(<@709044657232936960_=41mun-=52a=5b=49=52=43=5d>)
18:01:04FromDiscord<ali> relays \> nixie in clocks
18:02:10Amun-Rathat'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:22Amun-Raali: yes, the clock uses nixies
18:48:52*junaid_ joined #nim
19:05:59FromDiscord<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:44FromDiscord<albassort> I'm sure you can with some architecture
19:07:03FromDiscord<albassort> I don't know how id google this question though
19:07:37Amun-Rathat'd have to be some 1-bit cpu
19:08:10FromDiscord<albassort> Yeah but 64-bit CPUs Don't work on six byte instructions
19:08:17FromDiscord<albassort> Unless they do
19:08:34FromDiscord<albassort> Do you mean 1 bit byte cpu
19:08:36FromDiscord<Yepoleb> there is no way to address a single bit, all our addresses refer to bytes
19:09:07Amun-Raand very often operating on 32-bit atoms is faster than doing the same on 8-bit ones
19:09:23FromDiscord<albassort> Then... How does anything function?
19:10:01FromDiscord<albassort> If you can only assign bytes of 1 and 0s, how do you get any other combination
19:10:40FromDiscord<Yepoleb> you can assign any value to a byte
19:10:47FromDiscord<albassort> What instruction would create any arbitrary data from ↵00000000↵11111111
19:10:58FromDiscord<albassort> Damn non monospace font
19:11:24FromDiscord<Yepoleb> you just always have to assign 8, 16, 32 or 64 bits at once
19:11:45FromDiscord<Yepoleb> with some architectures this is even more limited
19:12:04FromDiscord<albassort> In reply to @Yepoleb "you can assign any": So you assign a 16 bit integer then cleave out a 8bit value
19:12:20FromDiscord<albassort> Sound inefficient
19:12:41Amun-Rainefficient in terms of?
19:12:46FromDiscord<albassort> But I know nothing about CPU architecture
19:13:12FromDiscord<Yepoleb> In reply to @albassort "So you assign a": i don't understand
19:13:24FromDiscord<albassort> In reply to @Amun-Ra "inefficient in terms of?": You're saying that because we can't assign individual bytes
19:13:32FromDiscord<albassort> Wrong reply
19:13:48Amun-Rayou 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:03FromDiscord<albassort> We can assign a byte of 00000000 and 11111111 and then logically create any arbitrary value
19:14:05FromDiscord<albassort> That's how I interpret it
19:14:29Amun-Rayou read a byte, modify a bit, write a byte; that's how it goes
19:14:42FromDiscord<albassort> In reply to @Amun-Ra "you read a byte,": OH
19:15:01FromDiscord<albassort> I thought they meant that you can't read or write a byte
19:15:32FromDiscord<albassort> I was confused on how anything would work at all if you can't write bytes individually
19:16:06FromDiscord<Yepoleb> bytes yes, bits no
19:16:14FromDiscord<albassort> AHH
19:16:23FromDiscord<albassort> (edit) "byte" => "bits"
19:16:31FromDiscord<albassort> (edit) "bytes" => "bits"
19:16:33FromDiscord<albassort> I hate typing on a phone
19:17:48FromDiscord<Yepoleb> to set the third bit (counting from 0) in a variable you have to do `x = x or (1 shl 3)`
19:20:52FromDiscord<albassort> I understand what's happening now dw
19:33:48FromDiscord<albassort> Is there any way to switch between let and const
19:33:55FromDiscord<albassort> Like do I need a macro to do that.
19:34:11FromDiscord<albassort> I want there to be a compiler option where all of my lets that can be const are made into const
19:35:49FromDiscord<guttural666> what is de way to define an int type to only accept values from 1 to 10?
19:38:15FromDiscord<ali> to what end?↵(@albassort)
19:42:50*junaid_ quit (Remote host closed the connection)
19:44:55FromDiscord<albassort> In reply to @ali "to what end? (<@217459674700578816>)": Statically linking
19:46:50FromDiscord<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:17FromDiscord<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:25FromDiscord<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:27FromDiscord<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:09FromDiscord<GalacticColourisation> (for what it's worth, elegantbeef, wat you ahd i woulldn't consider an effect system either )
20:09:25FromDiscord<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:56FromDiscord<hotdog> In reply to @guttural666 "the compiler doesn't seem": Convention is to uppercase first letter for types
20:10:33FromDiscord<EyeCon> In reply to @guttural666 "the compiler doesn't seem": You expect to be able to name types and variables the same? 🤔
20:15:32FromDiscord<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:48FromDiscord<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:11FromDiscord<EyeCon> http://nim-lang.github.io/Nim/manual.html#types-array-and-sequence-types
20:19:18FromDiscord<ratapenado> Thank you. The number of objects is known at compile time
20:21:23FromDiscord<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:54FromDiscord<GalacticColourisation> there isnt much wrong with that
20:22:30FromDiscord<GalacticColourisation> its just calling it "effect system" is misleading
20:23:04FromDiscord<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:29FromDiscord<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:17FromDiscord<guttural666> In reply to @EyeCon "You expect to be": yes, because the compiler should be smarter than me
20:30:41FromDiscord<guttural666> In reply to @hotdog "Convention is to uppercase": thought Nim was case insensitive? 😛
20:31:53FromDiscord<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:10FromDiscord<guttural666> In reply to @hotdog "Case insensitive except for": ahhhhh, very nice, wasn't aware, thanks!
20:32:53FromDiscord<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:08FromDiscord<hotdog> In reply to @guttural666 "ahhhhh, very nice, wasn't": No worries
20:33:23FromDiscord<guttural666> yeh yeh, right, thanks!
20:33:33FromDiscord<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:37FromDiscord<hotdog> It seems quirky coming from other languages, but in practice it works nicely and makes sense
20:35:17FromDiscord<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:50FromDiscord<albassort> In reply to @ali "I'll let someone who": I don't know what this means
20:36:31FromDiscord<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:19FromDiscord<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:33FromDiscord<hotdog> In reply to @guttural666 "types like MainWindow and": I meant the case insensitivity seeming quirky
20:40:36FromDiscord<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:37FromDiscord<albassort> In reply to @ali "Ah that's what I": Yeah then why have the option to have const in general then
20:41:42FromDiscord<albassort> Doesn't make any sense
20:42:07FromDiscord<ali> It does because it tells people and the compiler what you expect.
20:42:17FromDiscord<albassort> You know what I mean
20:42:21FromDiscord<ali> If you use const and it doesn't work compiler will let you know
20:42:51FromDiscord<dlesnoff> but not the other way around
20:43:13FromDiscord<dlesnoff> because it can't
20:43:43FromDiscord<ali> tenor\_gif7750227432097982833.gif https://media.discordapp.net/attachments/371759389889003532/1044714817954529390/tenor_gif7750227432097982833.gif
20:43:43FromDiscord<dlesnoff> It can not guess that a `let` variable will only be used at CT
20:43:53FromDiscord<ali> If it's anything like constexpr ?
20:45:17FromDiscord<ali> GCC does sometimes without constexpr anyways↵(@dlesnoff)
20:48:05FromDiscord<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:36FromDiscord<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:20FromDiscord<guttural666> vim global replace to the rescue
21:19:19FromDiscord<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:19FromDiscord<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:12FromDiscord<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:32FromDiscord<hotdog> Haven't used them though, and I've heard they are not as advanced as similar tools for other languages
21:25:26FromDiscord<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:27FromDiscord<Tuatarian> How do I add a `Bracket` node to a `Prefix`?
21:25:49FromDiscord<Tuatarian> `newNode` gives some error saying it's an illegal statement in a macro
21:27:08FromDiscord<guttural666> In reply to @hotdog "Good to hear! You": that Nim style guide is really helpful, especially when you're new
21:28:20FromDiscord<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:35FromDiscord<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:10FromDiscord<Tuatarian> Trying to generate `@["1","2"]` in a macro
21:44:36FromDiscord<Tuatarian> On my phone, I'll be home and paste in ~15m
21:44:38FromDiscord<Tuatarian> Sorry
21:45:04FromDiscord<Tuatarian> In reply to @iWonderAboutTuatara "`newNode` gives some error": Saying nnkBracketExpr is illegal in a macro
21:45:54FromDiscord<Elegantbeef> You really dont↵(@albassort)
21:46:13FromDiscord<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:18FromDiscord<guttural666> seen this in a talk lately
21:46:24FromDiscord<Elegantbeef> tuatara it's `newCall("@", nnkBracketExpr.newTree(newLit"1", newLit"2"))`
21:47:09FromDiscord<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:22FromDiscord<Elegantbeef> `astGenRepr`?
21:47:32FromDiscord<hotdog> Yeah or `dumpAstGen`
21:47:54FromDiscord<guttural666> In reply to @hotdog "Yeah or `dumpAstGen`": think that was it, the Bulgarian dude had it in one of his talks
21:48:15FromDiscord<hotdog> sent a code paste, see https://play.nim-lang.org/#ix=4gAd
21:53:02FromDiscord<guttural666> sent a long message, see http://ix.io/4gAf
21:53:06FromDiscord<albassort> In reply to @Elegantbeef "You really dont (<@217459674700578816>)": Why not nerd
21:53:19FromDiscord<Elegantbeef> Cause it makes the code harder to reason about
21:53:24FromDiscord<Elegantbeef> What's on the heap and what's not
21:53:33FromDiscord<Elegantbeef> Where am i doing work and where am i not
21:53:42FromDiscord<albassort> I guess that's true as hell
21:53:50FromDiscord<albassort> I guess my make alternative will never happen
22:05:13FromDiscord<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:59FromDiscord<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:13FromDiscord<Elegantbeef> You have things like zero-functional though
22:06:47FromDiscord<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:08FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gAl
22:08:01FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4gAm
22:08:07FromDiscord<albassort> and less memory intensive
22:08:15FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gAn
22:08:22FromDiscord<Elegantbeef> It's the same
22:08:38FromDiscord<Elegantbeef> I dont use lambda procs
22:08:40FromDiscord<albassort> In reply to @Elegantbeef "You need to rewrite": which is pretty slow
22:08:55FromDiscord<Elegantbeef> no it's not
22:08:58FromDiscord<Elegantbeef> It's fast
22:08:59FromDiscord<albassort> how does ghc do this stuff?
22:09:17FromDiscord<Elegantbeef> Partial evaluation and intelligent iterators
22:09:18FromDiscord<albassort> if it is then why do you yell at me when i do a whole bunch of functional code
22:09:20FromDiscord<Elegantbeef> Like i just described
22:09:33FromDiscord<Elegantbeef> Cause the for loop is fast when you use sequtils it's not
22:12:07FromDiscord<albassort> In reply to @Elegantbeef "Cause the for loop": ok so we need to optimize sequtil
22:12:10FromDiscord<albassort> (edit) "sequtil" => "sequtils"
22:12:52FromDiscord<Elegantbeef> You cannot
22:13:16FromDiscord<&Makarov/1> sent a code paste, see https://paste.rs/0t7
22:13:18FromDiscord<&Makarov/1> https://media.discordapp.net/attachments/371759389889003532/1044737363986890772/image.png
22:13:22FromDiscord<Elegantbeef> There is no way of doing `myArbitraryIterator.map(myProc).filter(myProc)`
22:13:25FromDiscord<Elegantbeef> It's just impossible
22:13:36FromDiscord<&Makarov/1> https://media.discordapp.net/attachments/371759389889003532/1044737440423874725/image.png
22:13:40FromDiscord<albassort> then how do ghc be fast
22:13:44FromDiscord<albassort> wouldn't ghc be slow as fuck
22:13:47FromDiscord<Elegantbeef> ...
22:13:52FromDiscord<Elegantbeef> There is no way in Nim
22:14:00FromDiscord<albassort> well, why not
22:14:23FromDiscord<albassort> I know im being a little kid asking mommy "WHY IS THE SKY BLUE"
22:14:26FromDiscord<Elegantbeef> Do you only read parts of the messages
22:15:00FromDiscord<albassort> In reply to @Elegantbeef "I'd say there is": well yes, but, why not make a third implementation
22:15:13FromDiscord<Elegantbeef> Cause that requires compiler work?
22:15:29FromDiscord<albassort> why don't we do that
22:15:40FromDiscord<albassort> is it the fact that its effort
22:15:42FromDiscord<Elegantbeef> .... no clue why dont you?
22:15:43FromDiscord<albassort> or is it a technical thing
22:15:44FromDiscord<Elegantbeef> All features start unimplemented
22:16:20FromDiscord<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:29FromDiscord<Elegantbeef> None of those fields are exported↵(@&Makarov/1)
22:17:09FromDiscord<&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:19FromDiscord<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:19FromDiscord<Elegantbeef> Correct you're not
22:17:56FromDiscord<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:46FromDiscord<albassort> I have been wanting like megazip
22:18:58FromDiscord<albassort> where you can just chain arbitrary number of iterators
22:19:15FromDiscord<Elegantbeef> I mean you can chain arbitrary number of iterators
22:19:30FromDiscord<Elegantbeef> The issue there is they have to be closures
22:19:53FromDiscord<albassort> closures are lame
22:20:03FromDiscord<albassort> until they're not
22:20:04FromDiscord<Elegantbeef> Which means they're slower than the inline counterpart
22:20:07FromDiscord<Elegantbeef> Closures arent really lame
22:20:20FromDiscord<albassort> in this usecase there is
22:20:27FromDiscord<albassort> (edit) "there is" => "they are"
22:20:32FromDiscord<Elegantbeef> Closures are first class, which is fantastic
22:20:32FromDiscord<Elegantbeef> Except for the whole part where the compiler does not inline them where they can
22:21:50*pbotfullerton joined #nim
22:22:28FromDiscord<Elegantbeef> In theory one could inline a closure based of a criteria
22:23:04FromDiscord<Elegantbeef> So then like `for x in mySeq.items.map(mapProc).filter(filterProc): ...` could be nearly as fast as the inline implementation
22:31:02pbotfullertonHello, 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:53FromDiscord<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:44FromDiscord<arkanoid> Test matrix test
22:45:50arkanoidYeah!
22:51:40FromDiscord<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:29FromDiscord<Elegantbeef> Depends on what you're doing simd, might be more approachable to threading
22:54:06FromDiscord<arkanoid> Also I've never used simd
22:54:27FromDiscord<Elegantbeef> It's a specialised tool so really depends what you are doing \:d
22:54:36FromDiscord<arkanoid> I should really quit my comfort zone and explore something new like that
22:56:47FromDiscord<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:39FromDiscord<ali> What's nimpy? Numpy?
22:58:34*oprypin_ joined #nim
22:59:08FromDiscord<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:13FromDiscord<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:27FromDiscord<ali> Very cool
23:00:04FromDiscord<arkanoid> It more than very cool. It's super cool. It puts cython to shame
23:03:10FromDiscord<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:04FromDiscord<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:10FromDiscord<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:36pbotfullertonWait 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:45FromDiscord<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:24FromDiscord<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:49FromDiscord<Elegantbeef> The built in Nim lines iterator uses some complex code that's hard to reason
23:15:49FromDiscord<Elegantbeef> That's my argument for why it's slow
23:19:55FromDiscord<auxym> I wonder why it needs to be so complex. consume bytes until newline -> return bytes
23:25:02FromDiscord<Elegantbeef> Well that's what mine does
23:25:03FromDiscord<Elegantbeef> Read data in 128 byte chunks copy up until a new line yield string
23:25:03FromDiscord<arkanoid> So "for x in @[1,2,3]\: ..." is slower looping over it using index 1,2,3?
23:25:03FromDiscord<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:05FromDiscord<Elegantbeef> No that's the same ark
23:25:09FromDiscord<Elegantbeef> The reason the iterator is slow is cause it depends on slow code
23:25:13FromDiscord<Elegantbeef> Iterators are supposed to be as fast as manually written loops, but if you depend on slow code it's slow
23:25:22FromDiscord<Elegantbeef> The code at the link i provided is the afformentioned slow code
23:25:24FromDiscord<Elegantbeef> The readline implemented is so complex i dont get why it's so complicated
23:26:47pbotfullertonHalf 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:43pbotfullertonMaybe it should be using getline instead?
23:37:22FromDiscord<GalacticColourisation> In reply to @Jiezron "From what I understand": correct
23:43:10*derpydoo quit (Ping timeout: 268 seconds)