00:00:00 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
00:00:02 | * | junland quit (Quit: %ZNC Disconnected%) |
00:01:05 | * | njoseph joined #nim |
00:01:47 | * | junland joined #nim |
00:13:15 | FromDiscord | <treeform> that was not in your snipit |
00:13:17 | FromGitter | <Knaque> My brain is just not functioning tonight, so I have to ask, what would be the easiest way of sending/receiving messages between a Nim program and a website? |
00:13:24 | Yardanico | http requests |
00:13:27 | FromDiscord | <treeform> ["foo"].getStr() or getFloat()... |
00:13:45 | FromDiscord | <treeform> I prefer websocket over http/rest |
00:13:52 | FromDiscord | <treeform> but http/rest is more widely used |
00:22:41 | * | enthus1ast quit (Ping timeout: 246 seconds) |
00:33:02 | * | a_chou quit (Remote host closed the connection) |
00:33:37 | FromGitter | <Knaque> When Treeform spoke up I remembered that he had a WebSocket library, and sure enough, that's all I needed. |
00:34:59 | * | enthus1ast joined #nim |
00:42:22 | FromDiscord | <treeform> yes I do |
00:42:24 | FromDiscord | <treeform> I love websockets |
01:00:56 | disruptek | dude. |
01:02:07 | * | lritter quit (Ping timeout: 240 seconds) |
01:03:02 | * | lritter joined #nim |
01:06:02 | * | hipoint-yc9 joined #nim |
01:09:45 | * | apahl quit (Ping timeout: 272 seconds) |
01:11:10 | * | apahl joined #nim |
01:13:26 | * | reversem3 quit (*.net *.split) |
01:13:27 | * | agentofuser[m] quit (*.net *.split) |
01:13:27 | * | silvernode[m] quit (*.net *.split) |
01:13:27 | * | orazovae[m] quit (*.net *.split) |
01:13:28 | * | unclechu quit (*.net *.split) |
01:13:29 | * | OMGOMG quit (*.net *.split) |
01:13:29 | * | hpyc9 quit (*.net *.split) |
01:13:29 | * | hipoint-yc9 quit (Quit: 420) |
01:13:57 | * | hpyc9 joined #nim |
01:18:47 | Prestige | sup disruptek |
01:25:35 | * | apahl quit (Ping timeout: 272 seconds) |
01:27:27 | * | apahl joined #nim |
01:31:31 | disruptek | what did i do? |
01:39:37 | * | kinkinkijkin quit (Remote host closed the connection) |
01:40:24 | * | abm quit (Quit: Leaving) |
01:44:29 | FromDiscord | <UNIcodeX> sent a code paste, see https://play.nim-lang.org/#ix=2ySm |
01:46:26 | FromDiscord | <UNIcodeX> (edit) 'https://play.nim-lang.org/#ix=2ySm' => 'https://play.nim-lang.org/#ix=2ySo' |
02:01:04 | * | krux02 quit (Remote host closed the connection) |
02:08:10 | FromDiscord | <Elegant Beef> I could be wrong but i think the template generates an identfier with gensym which causes an issue with the macro invoke |
02:13:13 | FromDiscord | <UNIcodeX> it doesn't like `fmt`. If I use `"$1 : $2".format(cpuTime()-tStart, label)` it works.... |
02:13:19 | FromDiscord | <Elegant Beef> Well yea |
02:13:24 | FromDiscord | <UNIcodeX> but.... I lose formatting. |
02:13:24 | FromDiscord | <Elegant Beef> https://play.nim-lang.org/#ix=2ySz this works aswell |
02:13:57 | FromDiscord | <Elegant Beef> I dont know the properway to use the template identifier for the macro, but what i just did is a dumb method of doing it |
02:14:26 | FromDiscord | <UNIcodeX> I didn't know about inject pragman |
02:14:27 | FromDiscord | <UNIcodeX> (edit) 'pragman' => 'pragma' |
02:14:44 | FromDiscord | <Elegant Beef> Well it's akin to properly declaring a variable so it's not proper to use here i imagine |
02:14:57 | FromDiscord | <Elegant Beef> Since if you dont block it, it defines tElapsed into scope |
02:15:30 | FromDiscord | <Elegant Beef> So it works but until someone smarter than me says if it's a hack or a proper fix i still fill iffy about using it 😄 |
02:15:37 | FromDiscord | <Elegant Beef> feel* |
02:20:44 | FromDiscord | <UNIcodeX> > Well it's akin to properly declaring a variable so it's not proper to use here i imagine↵@Elegant Beef interesting, but I'm getting this `Error: undeclared identifier: 'label'` |
02:20:51 | FromDiscord | <UNIcodeX> straight copy and paste |
02:21:04 | FromDiscord | <UNIcodeX> choosenim devel |
02:21:13 | FromDiscord | <Elegant Beef> I mean works on nim playground |
02:21:59 | FromDiscord | <Elegant Beef> oh |
02:22:05 | FromDiscord | <Elegant Beef> forgot that you pass a string to the template |
02:27:46 | FromDiscord | <Elegant Beef> I say just clap your hands until someone that knows templates shows up 😄 |
02:33:37 | disruptek | you can use .inject in the params, too, but i can't even tell what you're trying to accomplish. |
02:34:11 | FromDiscord | <UNIcodeX> I'm just trying to find out how long certain parts of a procedure take. |
02:35:36 | disruptek | i usually try: body finally: evho |
02:37:18 | disruptek | you can var foo {.inject.}: string and then set it inside the body; just insert your declaration in front of the body. the body can access it because it's in scope. |
02:38:10 | disruptek | if you want to access something local but not necessarily in the caller, you use bindsym. |
02:41:14 | FromDiscord | <flywind> May be better not to use `fmt` in templates. |
02:41:58 | FromDiscord | <flywind> I have ever written similar program without `fmt` https://github.com/xflywind/timeit/blob/ba4e90546af33632aea06208bc0f2d33418d2558/src/timeitpkg/main.nim#L146 |
02:47:15 | FromDiscord | <UNIcodeX> > I have ever written similar program without `fmt` https://github.com/xflywind/timeit/blob/ba4e90546af33632aea06208bc0f2d33418d2558/src/timeitpkg/main.nim#L146↵@flywind Nice. Why oh why did I try to reinvent the wheel. This does what I'm looking for. Thanks! |
02:48:35 | FromDiscord | <flywind> no problem |
03:02:29 | * | muffindrake quit (Ping timeout: 272 seconds) |
03:04:01 | * | muffindrake joined #nim |
04:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:34 | * | supakeen joined #nim |
04:07:31 | * | leorize[m]1 left #nim ("User left") |
04:07:49 | * | leorize[m]1 joined #nim |
04:15:35 | disruptek | !repo criterion |
04:15:36 | disbot | https://github.com/LemonBoy/criterion.nim -- 9criterion.nim: 11Statistic-driven micro-benchmark framework 15 38⭐ 4🍴 7& 1 more... |
04:19:53 | * | shad0w_ joined #nim |
04:29:46 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
04:33:32 | FromDiscord | <hobbledehoy> Nice |
04:51:17 | FromDiscord | <iWonderAboutTuatara> Hey everyone |
04:51:23 | FromDiscord | <iWonderAboutTuatara> ah dammit beef is offline |
04:51:41 | FromDiscord | <iWonderAboutTuatara> trying to implement a `->` instead of a `:` for proc return types to learn more about macros |
04:52:05 | FromDiscord | <iWonderAboutTuatara> and I'm getting really stuck on how to loop through something here |
04:52:25 | FromDiscord | <iWonderAboutTuatara> when i take `->` as the macro I don't get a NN with the full proc decl |
04:52:29 | FromDiscord | <iWonderAboutTuatara> so It's hard to work with |
04:59:12 | FromDiscord | <Elegant Beef> Dammit sucks he's offline |
05:00:54 | FromDiscord | <iWonderAboutTuatara> lmaoo |
05:01:05 | FromDiscord | <iWonderAboutTuatara> glad you're here, you're the expert on this kind of thing |
05:01:10 | FromDiscord | <iWonderAboutTuatara> any way to test this kind of thing? |
05:01:17 | FromDiscord | <iWonderAboutTuatara> sent a code paste, see https://play.nim-lang.org/#ix=2ySY |
05:01:23 | FromDiscord | <iWonderAboutTuatara> this is an AST from this statmenet |
05:01:26 | FromDiscord | <Elegant Beef> I'm not an expert |
05:01:28 | FromDiscord | <iWonderAboutTuatara> `f(s : int) -> int : return 1` |
05:01:31 | FromDiscord | <iWonderAboutTuatara> close enough |
05:01:49 | FromDiscord | <iWonderAboutTuatara> (edit) '`f(s' => '```nim↵f(s' | '1`' => '1```' |
05:02:02 | FromDiscord | <Elegant Beef> You're attempting to replicate swift return types? |
05:02:27 | FromDiscord | <iWonderAboutTuatara> idk if its in swift |
05:02:33 | FromDiscord | <iWonderAboutTuatara> attempting to replicate -> return types |
05:02:37 | FromDiscord | <iWonderAboutTuatara> but, only for pure funcs |
05:02:50 | FromDiscord | <iWonderAboutTuatara> ie using `->` indicates a func and `:` indicates a pro |
05:02:53 | FromDiscord | <iWonderAboutTuatara> (edit) 'pro' => 'proc' |
05:03:15 | FromDiscord | <Elegant Beef> Ok so what |
05:03:17 | FromDiscord | <Elegant Beef> (edit) 'what' => 'what's the issue' |
05:03:31 | FromDiscord | <iWonderAboutTuatara> When I pass this to the proc |
05:03:59 | FromDiscord | <iWonderAboutTuatara> Is it just passing the `Ident ->` or the entire Stmtlist or the infix? |
05:04:28 | FromDiscord | <iWonderAboutTuatara> How do I check what's being passed also, when writing this outside of a dumptree throws error |
05:04:41 | FromDiscord | <Elegant Beef> Well without the macro made of course it'd error |
05:09:44 | FromDiscord | <Elegant Beef> @iWonderAboutTuatara seems like you're trying to change nim's syntax which isnt allowed |
05:10:47 | FromDiscord | <iWonderAboutTuatara> not allowed? |
05:10:49 | FromDiscord | <iWonderAboutTuatara> That's sad |
05:14:00 | FromDiscord | <Elegant Beef> Actually im uncertain why it was being a pain |
05:14:16 | FromDiscord | <iWonderAboutTuatara> wdym macro mode? |
05:14:20 | FromDiscord | <iWonderAboutTuatara> bit confused |
05:14:27 | FromDiscord | <Elegant Beef> made |
05:14:37 | FromDiscord | <iWonderAboutTuatara> no doubt |
05:14:50 | FromDiscord | <iWonderAboutTuatara> but I want to know what exactly is being passed, infix or ident |
05:14:59 | FromDiscord | <Elegant Beef> Well i mean this works https://play.nim-lang.org/#ix=2yT1 |
05:16:27 | * | solitudesf joined #nim |
05:17:04 | FromDiscord | <iWonderAboutTuatara> wait how is it only passing things on the left? |
05:17:48 | FromDiscord | <iWonderAboutTuatara> wait yeah how did you seperate them? |
05:18:05 | FromDiscord | <Elegant Beef> I have limited knowledge on how the parser works 😄 |
05:18:49 | FromDiscord | <Elegant Beef> `->` is an operator which means it requires a macro which takes a left and right, then you know you want a body which requires an `:` or possibly `=` although im uncertain of the latter |
05:19:25 | FromDiscord | <iWonderAboutTuatara> I see |
05:19:33 | FromDiscord | <iWonderAboutTuatara> so left and right in the macro params are keywords? |
05:19:40 | FromDiscord | <Elegant Beef> Nope |
05:19:57 | FromDiscord | <iWonderAboutTuatara> parser assumes first param is left and next is right? |
05:20:00 | FromDiscord | <Elegant Beef> It's an operator so it takes a left side and a right side |
05:20:05 | FromDiscord | <Elegant Beef> Yea i think so 😄 |
05:20:09 | FromDiscord | <iWonderAboutTuatara> oh interesting |
05:20:21 | FromDiscord | <iWonderAboutTuatara> this seems super complex |
05:20:29 | FromDiscord | <iWonderAboutTuatara> /confusing |
05:21:24 | FromDiscord | <Elegant Beef> Lol you can do it, it's not too bad, all you have to do is generate the identdefs for a func definition and then set it's body to what you get from the user |
05:21:46 | FromDiscord | <Elegant Beef> I believe in you! |
05:22:03 | FromDiscord | <iWonderAboutTuatara> thanks! |
05:22:30 | FromDiscord | <iWonderAboutTuatara> so because `->` is interpreted as an operation |
05:22:35 | FromDiscord | <iWonderAboutTuatara> because its an operator/symbol |
05:23:13 | FromDiscord | <Elegant Beef> Yep |
05:23:17 | FromDiscord | <iWonderAboutTuatara> it takes an operand (left side, first param) and another operand (right side, second param) |
05:23:31 | FromDiscord | <Elegant Beef> That's my take on it |
05:23:34 | FromDiscord | <Elegant Beef> I could be wrong 😛 |
05:23:38 | FromDiscord | <iWonderAboutTuatara> then because of the `:` that's a third nodeset/thing so I need a third param? |
05:23:50 | * | thomasross quit (Ping timeout: 272 seconds) |
05:25:13 | FromDiscord | <Elegant Beef> Yea i think so 😄 |
05:25:17 | FromDiscord | <iWonderAboutTuatara> so I think it's dependant on the number of same level nodes you need |
05:25:24 | FromDiscord | <iWonderAboutTuatara> if you take anything less then 3 here than it throws an error |
05:25:26 | * | apahl quit (Ping timeout: 246 seconds) |
05:25:36 | FromDiscord | <iWonderAboutTuatara> sent a code paste, see https://play.nim-lang.org/#ix=2yT7 |
05:25:57 | FromDiscord | <iWonderAboutTuatara> oops |
05:26:02 | FromDiscord | <iWonderAboutTuatara> sent a code paste, see https://play.nim-lang.org/#ix=2yT8 |
05:26:12 | FromDiscord | <iWonderAboutTuatara> the macro itself is `Ident "->"` |
05:26:28 | FromDiscord | <iWonderAboutTuatara> We need Call block, Ident Int, and StmtList |
05:26:41 | * | apahl joined #nim |
05:27:00 | FromDiscord | <iWonderAboutTuatara> if we take any less than that in the macro, we just have either `int` or `: discard` hanging out which throws an error |
05:27:05 | FromDiscord | <iWonderAboutTuatara> specifically an indent compiler error |
05:27:22 | FromDiscord | <iWonderAboutTuatara> the first macro param takes the first same level node, ie the call |
05:27:36 | FromDiscord | <iWonderAboutTuatara> second macro param takes the 2nd same level node, ie the `Ident "int"` |
05:27:50 | FromDiscord | <iWonderAboutTuatara> third marco param takes the 3rd same level node, ie the `StmtList` |
05:28:00 | FromDiscord | <iWonderAboutTuatara> Could be completely wrong on this, but this is what I got from like 2 seconds |
05:28:29 | FromDiscord | <Elegant Beef> That's about all there is |
05:39:52 | * | voltist quit (Remote host closed the connection) |
05:52:36 | FromDiscord | <iWonderAboutTuatara> That's good, I can work with that! |
05:55:04 | * | narimiran joined #nim |
06:06:38 | * | arecacea1 quit (Remote host closed the connection) |
06:07:03 | * | arecacea1 joined #nim |
06:10:59 | * | nikita` joined #nim |
06:12:48 | * | mmohammadi9812 joined #nim |
06:16:35 | * | mmohammadi98129 joined #nim |
06:17:57 | * | mmohammadi9812 quit (Ping timeout: 256 seconds) |
06:17:58 | * | mmohammadi98129 is now known as mmohammadi9812 |
06:26:46 | * | lritter quit (Ping timeout: 246 seconds) |
06:27:16 | * | kenran joined #nim |
06:34:33 | * | kungtotte quit (Read error: Connection reset by peer) |
06:34:39 | * | mmohammadi9812 quit (Ping timeout: 258 seconds) |
06:35:45 | * | kungtotte joined #nim |
06:36:35 | FromDiscord | <Elegant Beef> @iWonderAboutTuatara are you bald yet from pulling your hair out? 😛 |
06:43:52 | * | kenran quit (Ping timeout: 256 seconds) |
06:51:22 | FromDiscord | <iWonderAboutTuatara> I actually tooka bit of a break |
06:51:25 | FromDiscord | <iWonderAboutTuatara> to prevent hair loss |
06:57:31 | * | vicfred quit (Remote host closed the connection) |
06:57:56 | * | vicfred joined #nim |
07:04:08 | * | zielmicha__ quit (Read error: Connection reset by peer) |
07:04:33 | * | alehander92 quit (Ping timeout: 258 seconds) |
07:04:50 | * | zielmicha__ joined #nim |
07:05:49 | * | alehander92 joined #nim |
07:13:52 | * | Vladar joined #nim |
07:23:06 | * | mmohammadi98129 joined #nim |
07:32:41 | * | mmohammadi98129 quit (Quit: I quit (╯°□°)╯︵ ┻━┻) |
07:41:29 | * | kinkinkijkin joined #nim |
07:42:42 | * | arecacea1 quit (Remote host closed the connection) |
07:43:11 | * | arecacea1 joined #nim |
07:47:15 | * | bung joined #nim |
07:49:47 | * | mmohammadi98129 joined #nim |
07:50:49 | bung | I create socket on main thread, pass it to child thread , let it do io work, that doesn't work, right? |
07:52:40 | bung | I got File descriptor not registered. |
07:53:13 | * | narimiran quit (Ping timeout: 246 seconds) |
07:56:46 | * | kinkinkijkin quit (Remote host closed the connection) |
07:57:10 | * | kinkinkijkin joined #nim |
07:59:41 | leorize | bung: you are doing cross-thread async? |
08:00:10 | leorize | then you will have to use asyncdispatch.unregister(fd) on the thread that spawned the socket |
08:00:29 | leorize | then register() on the thread that control the socket |
08:11:30 | bung | not sure that fit my case, on the main thread side , I do newAsyncSocket connect, on the child thread I call async proc and addCallback to that future. |
08:25:11 | * | mmohammadi98129 quit (Quit: Ping timeout (120 seconds)) |
08:26:00 | * | mmohammadi98129 joined #nim |
08:28:43 | bung | leorize let me try |
08:35:26 | * | reversem3 joined #nim |
08:35:26 | * | orazovae[m] joined #nim |
08:35:26 | * | agentofuser[m] joined #nim |
08:35:26 | * | silvernode[m] joined #nim |
08:35:26 | * | unclechu joined #nim |
08:35:26 | * | OMGOMG joined #nim |
08:37:57 | * | superbia1 is now known as superbia |
08:42:57 | bung | leorize it's worked , ty! |
08:58:22 | * | superbia1 joined #nim |
08:58:26 | * | shad0w_ quit (Ping timeout: 260 seconds) |
09:00:42 | * | superbia quit (Ping timeout: 258 seconds) |
09:02:05 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:30:58 | * | mmohammadi98129 quit (Ping timeout: 256 seconds) |
09:39:13 | * | mmohammadi98129 joined #nim |
10:10:26 | * | waleee-cl joined #nim |
10:11:05 | * | mmohammadi98129 quit (Ping timeout: 240 seconds) |
10:15:11 | * | fowl quit (Read error: Connection reset by peer) |
10:15:19 | * | sirn quit (Read error: Connection reset by peer) |
10:15:28 | * | fowl joined #nim |
10:15:43 | * | sirn joined #nim |
10:19:55 | * | MyMind joined #nim |
10:21:28 | * | Sembei quit (Ping timeout: 256 seconds) |
10:21:32 | * | mmohammadi98129 joined #nim |
10:21:57 | FromDiscord | <enthus1ast> @flywind don't feel disencourage when i open issues in prologue; i enjoy useing it so far 🙂 |
10:33:49 | FromDiscord | <flywind> Never mind. I am more afraid of without users than without issues 😄 |
10:37:24 | * | abm joined #nim |
10:38:51 | FromDiscord | <flywind> @enthus1ast |
10:43:02 | * | surma quit (Ping timeout: 272 seconds) |
10:44:45 | * | surma joined #nim |
10:50:43 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
10:51:00 | * | ehmry joined #nim |
11:12:28 | FromGitter | <cschardt> I happend to notice, that the colon character somehow operates like a function call, see for all variations https://play.nim-lang.org/#ix=2yUC |
11:13:33 | FromGitter | <cschardt> Could I have known this by reading the manual? Can sombody point me to the section, where this is explained? |
11:13:48 | FromDiscord | <Rika> colons after a function call pass the statements after the colon as the last parameter of the function |
11:13:52 | FromDiscord | <lqdev> that's because you're passing a code block as the last param |
11:14:03 | FromDiscord | <lqdev> which evaluates to the last statement in the block |
11:14:42 | FromDiscord | <Rika> the *result of the statement |
11:14:49 | FromDiscord | <Rika> made a mistake |
11:24:04 | * | sealmove joined #nim |
11:25:30 | ForumUpdaterBot | New thread by Chaemon: Calling same-named-function from abstruct object, see https://forum.nim-lang.org/t/6864 |
11:25:40 | * | mmohammadi98129 quit (Ping timeout: 246 seconds) |
11:34:43 | * | newUser joined #nim |
11:36:31 | newUser | hi, I have for example a #define D2PI (6.283185307179586476925287) in a C header file and want to import it into a nim file, how can I do this? |
11:38:27 | FromDiscord | <haxscramper> No, you can't directly import C defines. The Closest nim alternative would be `const D2PI = 6.283185307179586476925287` |
11:40:00 | orazovae[m] | how do I sort a sequence? |
11:41:18 | newUser | thx |
11:41:19 | * | Trustable joined #nim |
11:48:23 | sealmove | newUser: there is a program called c2nim which does the bulk of the work, but usually you still need to tweak the result. |
11:48:43 | newUser | k |
11:49:31 | sealmove | check it out with `nimble install c2nim`, and then the syntax is `c2nim <c header file>` in the command-line. |
11:50:28 | sealmove | honestly this is the only feature I am jealous of Zig... |
11:51:24 | FromDiscord | <Rika> orazovae: import algorithm and use the sort proc there |
11:51:43 | newUser | yup, works |
11:51:47 | newUser | thx |
11:52:16 | newUser | const D2PI* = (6.283185307179586) |
11:52:43 | newUser | nice is the struct conversion.... |
11:52:48 | sealmove | and some other preprocessor stuff turn into templates |
11:53:50 | sealmove | personally I still find it tedious to make C bindings... |
11:54:03 | sealmove | but maybe that's as good as it can get |
11:54:11 | newUser | I'm only playing around with it... |
11:56:49 | FromDiscord | <krisppurg> How would you do this in Nim? In python:↵`struct.pack_into(">I", header, 8, 60028)`↵I'm kind of struggling and confused with byte stuff in Nim. |
11:57:17 | sealmove | krisppurg we don't have standard lib procs for that |
11:58:12 | sealmove | maybe try this? https://github.com/OpenSystemsLab/struct.nim |
12:00:13 | newUser | sealmove: I have converted some procs too with c2nim, but there is missing {.importc, header:... after every proc, is it possible with one declaration to import all functions from header file |
12:00:16 | newUser | ? |
12:01:29 | sealmove | I think it's not :| |
12:01:39 | newUser | so copy and paste... |
12:01:48 | sealmove | you can use a seperate file and run c2nim on the header |
12:02:22 | sealmove | then import the resulting file of c2nim |
12:02:59 | newUser | yes, but I get proc1, proc 2 etc but without proc1 {.importc, header:, proc 2 {.importc, header: ... etc |
12:03:52 | FromDiscord | <Rika> you can use a separate pragma-making pragma to at least reduce the repetition of the pragma |
12:04:04 | sealmove | I see, maybe take a look at c2nim's options |
12:04:30 | sealmove | if it's not possible then it's a good potential feature request for c2nim |
12:04:48 | newUser | <Rika> how this? |
12:05:27 | newUser | the best is to have one {.importc, header: on top of the file... |
12:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:30 | FromDiscord | <Rika> you can do something like `{.pragma: name, importc, header: ....}` then use `{.name.}` on all function declarations |
12:06:38 | * | supakeen joined #nim |
12:06:47 | newUser | ahhh, ok |
12:07:23 | * | bra-ket quit (Ping timeout: 240 seconds) |
12:26:03 | bung | params:varargs[T] using @params turn to seq[T], right ? I still get `which cannot be captured as it would violate memory safety` |
12:26:33 | * | xace quit (Ping timeout: 258 seconds) |
12:26:56 | FromDiscord | <Rika> full error and code please |
12:27:06 | FromDiscord | <Rika> rather, minimized code if possible |
12:27:47 | bung | see https://play.nim-lang.org/#ix=2yV2 |
12:27:53 | FromDiscord | <Rika> will look |
12:28:43 | * | xace joined #nim |
12:28:54 | FromDiscord | <shashlick> @newUser there is a header option for c2nim |
12:29:04 | FromDiscord | <shashlick> What are your wrapping though |
12:29:31 | newUser | ? |
12:30:46 | FromDiscord | <Rika> there seems to be some weird issues regards varargs and async? |
12:30:48 | newUser | I have converted a header file from c to nim and have now many procs but without {.importc, header: " ... etc |
12:31:19 | newUser | to use the static lib |
12:31:53 | newUser | I have picked 2 functions and it works |
12:32:27 | newUser | but I don't want to copy and paste 200 times and more the same importc |
12:33:07 | FromDiscord | <Rika> you can probably use the push and pop pragma |
12:33:13 | newUser | with {.pragma: name, importc, header: ....} works but the same, copy and paste |
12:33:15 | FromDiscord | <Rika> {.push: importc....} |
12:33:23 | FromDiscord | <Rika> this will apply to all under the pragma |
12:33:24 | newUser | on top |
12:33:31 | FromDiscord | <Rika> then just {.pop.} to end it |
12:33:43 | newUser | will try it |
12:33:56 | FromDiscord | <Rika> put it on an empty line |
12:34:38 | bung | Rika I didn't know that, I remeber I can use @ |
12:35:31 | FromDiscord | <Rika> well i cant access the param at all no matter what i do |
12:35:37 | FromDiscord | <Rika> so its not @ but the varargs type |
12:35:41 | FromDiscord | <Rika> thats the issue |
12:35:44 | FromDiscord | <Rika> i believe |
12:38:35 | newUser | <Rika> biggggg smilleeee, thx |
12:38:44 | newUser | it works |
12:38:55 | newUser | but after push no : |
12:39:00 | FromDiscord | <Rika> yes |
12:39:02 | FromDiscord | <Rika> its not a block |
12:39:05 | FromDiscord | <Rika> its just a pragma |
12:39:09 | FromDiscord | <Rika> its kinda weird but eh |
12:39:57 | newUser | hurray.... thx a lot, have a nice sunday, bye |
12:40:09 | * | newUser quit (Remote host closed the connection) |
12:40:31 | bung | does it related to object variant param ? |
13:11:25 | * | tane joined #nim |
13:22:07 | * | solitudesf- joined #nim |
13:22:38 | * | solitudesf quit (Ping timeout: 272 seconds) |
13:51:04 | * | krux02 joined #nim |
13:55:12 | FromDiscord | <Recruit_main707> newUser, as shashlick said, c2nim has a --header option that will actually wrap the header file instead of transpiling it |
13:56:10 | bung | Rika you're right, it just releated to async |
14:00:33 | * | bung quit (Quit: Lost terminal) |
14:07:44 | * | narimiran joined #nim |
14:18:08 | * | bung joined #nim |
14:22:23 | * | NimBot joined #nim |
14:26:36 | sealmove | @Rika just to clarify: after this `push` pragma you still have to declare all procs in nim right? |
14:27:26 | sealmove | I wonder if nim could somehow implement seemless interop with C, since it compiles to C... |
14:27:36 | FromDiscord | <Rika> yes |
14:28:19 | sealmove | for example Zig has this feature, but Zig is a C compiler, it doesn't compile to C, so I don't know... |
14:29:33 | FromDiscord | <Rika> nim is not a c compiler |
14:30:53 | sealmove | I guess Nim compiler would have to generate and inject the Nim declaration itself. Theoretically it's possible right? |
14:31:27 | FromDiscord | <Rika> is there a reason you arent using nimterop |
14:32:46 | * | bosyf joined #nim |
14:33:55 | bosyf | has anyone noticed there is no slice assignment for seqs? you cant do s[1..3] = @[1, 2, 3] for example but you can for arrays |
14:34:18 | sealmove | Doesn't nimterop depend on c2nim? meaning it has the same limitations. I guess it's not a matter of integrating it into the Nim compiler but rather improving c2nim. |
14:34:30 | FromDiscord | <Rika> look into it |
14:35:03 | bosyf | like you can set slices of arrays to either seqs or arrays, but you cant set slices of seqs to anything |
14:35:23 | FromDiscord | <Rika> probably just an oversight bosyf |
14:37:16 | bosyf | oh, my bad, i was assigning a seq of ints to a seq of bytes |
14:37:26 | * | bosyf quit (Remote host closed the connection) |
14:38:15 | FromDiscord | <Rika> oh lol |
14:40:19 | sealmove | ah nimterop doesn't depend on c2nim hmm |
15:04:58 | * | sealmove quit (Read error: Connection reset by peer) |
15:28:30 | * | gmaggior joined #nim |
15:46:16 | * | a_chou joined #nim |
16:13:28 | FromDiscord | <juan_carlos> Hacktoberfest incoming |
16:21:25 | * | a_chou quit (Ping timeout: 246 seconds) |
16:24:58 | * | a_chou joined #nim |
16:25:45 | FromDiscord | <Recruit_main707> is there something similar to `std::bind` for nim? |
16:27:16 | Zevv | nah, just wrap it in a closure proc |
16:29:41 | FromDiscord | <Recruit_main707> hmm, im not sure that would work, this is a pretty specific situation |
16:31:27 | * | dv-^_^6 joined #nim |
16:52:54 | FromDiscord | <haxscramper> Can also make all sorts of unpacking operators on top of pattern matching. Like `(_, (@a, @b)) := (1, (2, 3))`, `[@first, all @other] := [1,2,3]` and basically anything else |
16:53:21 | FromDiscord | <haxscramper> Using the same syntax as in`case` |
16:53:41 | FromDiscord | <haxscramper> And also rust's `if let` and `while let` |
16:53:51 | FromDiscord | <haxscramper> Basically for free |
16:55:53 | FromDiscord | <haxscramper> Like `a, *b = [1,2,3,4]` in python. And also nested tuple unpacking |
16:58:43 | FromDiscord | <Recruit_main707> Zevv: can you show me an example of your solution to a lack of `std::bind`? |
17:01:32 | FromDiscord | <KingDarBoja> > Hacktoberfest incoming↵Yeah |
17:01:36 | FromDiscord | <KingDarBoja> I posted it on <#371759607934353448> |
17:05:12 | FromDiscord | <dom96> what y'all contributing to? |
17:08:28 | disruptek | incremental compilation |
17:09:20 | FromDiscord | <haxscramper> Unpacking arrays into fixed-size slices is a common use case? |
17:09:28 | FromDiscord | <haxscramper> Like binary unpacking for example |
17:12:51 | Zevv | Recruit_main707: Can you explain your problem then? Maybe my understanding of ::bind is half baked |
17:13:20 | Zevv | But basically no more then this trivial thing: https://play.nim-lang.org/#ix=2yWz |
17:15:52 | FromDiscord | <Recruit_main707> yep, i did something similar in the end |
17:16:02 | Zevv | and that didn't work? |
17:16:13 | FromDiscord | <Recruit_main707> i think it has |
17:16:27 | * | a_chou quit (Ping timeout: 240 seconds) |
17:16:28 | Zevv | well, there you go :) |
17:16:30 | FromDiscord | <Recruit_main707> the problem was that i have to pass an instance |
17:16:46 | Zevv | what's an instance |
17:16:52 | FromDiscord | <Recruit_main707> of an object |
17:17:06 | FromDiscord | <Avatarfighter> What is up everyone |
17:17:22 | Zevv | Recruit_main707: and why is/was that a problem? |
17:17:27 | Zevv | Avatarfighter: Hey there |
17:17:28 | FromDiscord | <Recruit_main707> now the "problem" is that i need to save that reference somewhere in my data structure, but i can live with that |
17:17:36 | FromDiscord | <Recruit_main707> Avatarfighter: sup |
17:17:41 | Zevv | Can't you save it in the closure? |
17:18:09 | FromDiscord | <Recruit_main707> i dont think so |
17:18:21 | Zevv | have you tried pushing it harder? |
17:18:24 | FromDiscord | <Avatarfighter> Zevv, Recruit_main707: What are you two doing? It sounds interesting. |
17:18:37 | Zevv | I have no clue. He's talking dirty C++ things |
17:18:52 | Zevv | which I don't understand. So I gave a nonsense answer which happened to be almost the right thing |
17:18:53 | FromDiscord | <Recruit_main707> acually, i might be able to |
17:19:07 | * | a_chou joined #nim |
17:19:18 | FromDiscord | <iWonderAboutTuatara> anyone running a linux box here? |
17:19:26 | FromDiscord | <Avatarfighter> cpp 😮 |
17:19:34 | FromDiscord | <Avatarfighter> I do @iWonderAboutTuatara Laptop + servers |
17:23:46 | Zevv | Recruit_main707: code is data, data is code. with closures you don't need objects. I bet you can do that just fine :) |
17:25:50 | * | hnOsmium0001 joined #nim |
17:30:37 | FromDiscord | <Recruit_main707> Zevv: im pretty sure i cant do it without saving the reference somewhere, here you have the most minimal example i could write showcasing the issue, just in case you want to have a look at it, but you already have done more than enough, so thanks.↵https://play.nim-lang.org/#ix=2yWE |
17:32:57 | FromDiscord | <iWonderAboutTuatara> how is it for desktop use? |
17:33:01 | FromDiscord | <iWonderAboutTuatara> how much size should I assign? |
17:33:32 | FromDiscord | <iWonderAboutTuatara> does it make more sense to go WSL on Windows or WINE on linux? |
17:33:58 | * | Vladar quit (Quit: Leaving) |
17:34:51 | Zevv | iWonderAboutTuatara: these are pretty broad questions |
17:35:12 | Zevv | I have never used windows in my life, but I find linux desktop use usually pretty crappy |
17:35:38 | FromDiscord | <Avatarfighter> @iWonderAboutTuatara I run Linux Mint on my laptop and I would say that the desktop experience is smoother if not better than windows. The only downside is the lack of a lot of big brand software(you'll find alternatives) and driver support and stuff |
17:36:03 | FromDiscord | <Avatarfighter> im WSL will do more than enough for most peoples needs |
17:36:21 | FromDiscord | <Avatarfighter> (edit) 'WSL' => 'sure *WSL' |
17:42:17 | FromDiscord | <lqdev> ah yes, linux users. |
17:42:34 | FromDiscord | <lqdev> honestly, please just stick with windows. it will save you a lot of headaches in the long run. |
17:42:46 | * | mmohammadi98129 joined #nim |
17:42:59 | FromDiscord | <lqdev> unless you want to spend countless hours on debugging why stuff doesn't wanna work, that is. |
17:45:11 | FromDiscord | <iWonderAboutTuatara> I mean, worth trying no? |
17:45:25 | FromDiscord | <iWonderAboutTuatara> I don't have major issues with win10 at the moment |
17:45:34 | FromDiscord | <iWonderAboutTuatara> I run linux on my laptop and it's fine |
17:46:00 | FromDiscord | <iWonderAboutTuatara> @Avatarfighter WSL doesn't support gui apps for whatever reason |
17:46:04 | FromDiscord | <iWonderAboutTuatara> at least not easilt |
17:46:11 | leorize | if you use intel/amd hardware linux will work 99% of the time |
17:46:17 | FromDiscord | <iWonderAboutTuatara> and also its broken for me |
17:46:25 | FromDiscord | <Avatarfighter> I tried upgrading my linux mint, I spent 4 hours getting everything ready and it failed and I have no idea why |
17:46:29 | FromDiscord | <iWonderAboutTuatara> I use intel it 7400 & nvidia gtx10603gb |
17:46:34 | FromDiscord | <iWonderAboutTuatara> would be using popos |
17:46:48 | FromDiscord | <iWonderAboutTuatara> who provides an ISO prebuilt with the proprietary nvidia drivers |
17:46:56 | superbia1 | archlinux |
17:47:16 | FromDiscord | <iWonderAboutTuatara> arch bad |
17:47:21 | FromDiscord | <iWonderAboutTuatara> I used arch for a bit |
17:47:28 | FromDiscord | <Yardanico> nvidia bad |
17:47:31 | FromDiscord | <iWonderAboutTuatara> way too much pain for way too little gain |
17:47:33 | FromDiscord | <iWonderAboutTuatara> agreed nvidia bad |
17:47:37 | leorize | if you want linux without having to scratch your head everytime an update breaks something, fedora silverblue is the best out there |
17:47:41 | FromDiscord | <iWonderAboutTuatara> but I buy the cheapest best hwcard |
17:47:49 | superbia1 | leorize: you want archlinux |
17:47:51 | Prestige | Arch and fedora are good |
17:47:55 | FromDiscord | <Avatarfighter> I need to figure out if I can upgrade the eMMC chip in my chromebook, I have recently learned that microsd cards can corrupt with repeatedly writing to it |
17:48:00 | FromDiscord | <iWonderAboutTuatara> see but then I'd ahve to deal with wayland and dnf |
17:48:06 | superbia1 | guck wayland |
17:48:14 | superbia1 | use xorg |
17:48:14 | leorize | wayland is cool |
17:48:15 | FromDiscord | <iWonderAboutTuatara> plus proprietary nvidia drivers on foss first fedora would suck for sure |
17:48:28 | FromDiscord | <iWonderAboutTuatara> wayland is unusable last i tried |
17:48:32 | FromDiscord | <Avatarfighter> I'm so sorry for starting this conversation guys |
17:48:44 | FromDiscord | <iWonderAboutTuatara> nah this is fun lmao |
17:48:46 | leorize | we should move this to #nim-offtopic |
17:48:50 | FromDiscord | <Avatarfighter> yeah we shoould |
17:48:50 | FromDiscord | <iWonderAboutTuatara> also it's my fault, I inquired first |
17:48:52 | FromDiscord | <iWonderAboutTuatara> good idea |
17:49:20 | FromDiscord | <Avatarfighter> Its fine though, everyone knows Linux Mint is the best so there shouldn't even be an argument 🥴 |
17:51:52 | FromDiscord | <Rika> MFs fuckin invaded the keyboard talk with this linux argument SMH |
17:54:59 | * | a_chou quit (Ping timeout: 240 seconds) |
17:58:35 | FromDiscord | <Avatarfighter> @Rika lmao |
17:59:08 | Adeon | does anyone know a link to a code or example that uses "genSym" the function in a template? |
17:59:26 | Adeon | I know there is {.gensym.} like "var something {.gensym.} =" but I wonder how the function itself would be used |
17:59:55 | FromDiscord | <haxscramper> You should use it in macros like `let variable = genSym(nskLet, "varname")` |
18:00:19 | Adeon | ah right yes |
18:00:22 | FromDiscord | <haxscramper> Templates are hygienic by default and there is no need to create unique identifiers explicitly |
18:01:41 | Adeon | thanks |
18:01:48 | FromDiscord | <haxscramper> Why `echo typeof((@[1,2,3][0..2]))` is `int` but the same expression evaluated - `echo (@[1,2,3][0..2])` clearly gives `seq[int]` |
18:04:20 | * | arecacea1 quit (Read error: Connection reset by peer) |
18:04:57 | * | arecacea1 joined #nim |
18:06:40 | FromDiscord | <iWonderAboutTuatara> confused about something with macros here |
18:06:51 | FromDiscord | <iWonderAboutTuatara> sent a code paste, see https://paste.rs/6cE |
18:07:55 | FromDiscord | <iWonderAboutTuatara> throws error `Invalid node kind nnkIdentDefs for macros.\`$\`` |
18:08:08 | FromDiscord | <Rika> cant print idefsd |
18:08:09 | FromDiscord | <Rika> (edit) 'idefsd' => 'idefs' |
18:08:10 | FromDiscord | <iWonderAboutTuatara> ```Invalid node kind nnkIdentDefs for macros.\`$\```` |
18:08:17 | FromDiscord | <iWonderAboutTuatara> oh, that is odd |
18:08:20 | leorize | use `treeRepr` to print NimNode |
18:08:21 | FromDiscord | <Rika> use repr or treerepr |
18:08:23 | FromDiscord | <haxscramper> You need to explicitly convert to string representation using `node.repr` or `node.toStrLit()` |
18:08:23 | FromDiscord | <Rika> its normal |
18:08:35 | FromDiscord | <iWonderAboutTuatara> was just a debugging thing |
18:08:46 | FromDiscord | <iWonderAboutTuatara> I just looped through each n in the idefs and printed that |
18:08:52 | FromDiscord | <iWonderAboutTuatara> man soem of these errors are so cryptic |
18:08:58 | FromDiscord | <iWonderAboutTuatara> especially with macros |
18:09:07 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2yWN |
18:09:27 | FromDiscord | <haxscramper> Highly recommend using for printf debugging |
18:09:40 | FromDiscord | <iWonderAboutTuatara> I don't know how to debug using not printf lol |
18:09:45 | FromDiscord | <lqdev> @haxscramper n.repr |
18:09:51 | FromDiscord | <iWonderAboutTuatara> people think I'm crazy but I've legitimately just never bothered |
18:09:55 | FromDiscord | <iWonderAboutTuatara> thanks for that though, will be using it |
18:10:17 | FromDiscord | <haxscramper> > @haxscramper n.repr↵@lqdev whatever. There is not visual difference so it does not really matter anyway |
18:10:54 | FromDiscord | <haxscramper> > I don't know how to debug using not printf lol↵@iWonderAboutTuatara This is explicitly superiour way of debugging IMO |
18:12:26 | FromDiscord | <iWonderAboutTuatara> print debugging? |
18:12:55 | FromDiscord | <iWonderAboutTuatara> It makes it very easy to identify exactly where the error is, which is why I've never bothered to learn another method |
18:13:10 | FromDiscord | <iWonderAboutTuatara> I really do need error highlighting to make programming tolerable though |
18:13:39 | FromDiscord | <iWonderAboutTuatara> new issue |
18:13:44 | FromDiscord | <iWonderAboutTuatara> sent a code paste, see https://play.nim-lang.org/#ix=2yWQ |
18:13:51 | FromDiscord | <iWonderAboutTuatara> for `f(a, b, c, int) -> int: return 1` |
18:14:13 | FromDiscord | <iWonderAboutTuatara> the issue is that the third thing I add to idefs (int) is set as the value of C |
18:14:15 | FromDiscord | <iWonderAboutTuatara> instead of the type |
18:14:45 | FromDiscord | <iWonderAboutTuatara> I know nim static type uses a default value |
18:14:51 | FromDiscord | <iWonderAboutTuatara> (I think anyway) |
18:17:07 | FromDiscord | <iWonderAboutTuatara> but is there a less painful way to make this work than a lot of if/switch statements? |
18:19:41 | FromDiscord | <haxscramper> Sorry I don't really follow what are you trying to do here, especially that part with "third thing I add to idefs (int) is set as the value of C". |
18:20:14 | FromDiscord | <lqdev> btw @iWonderAboutTuatara `left[1..^1] == left[1..left.len - 1]` |
18:20:24 | FromDiscord | <haxscramper> You need to pass /value/ instead nim node for `c`? |
18:27:41 | FromDiscord | <iWonderAboutTuatara> oh you can ^1, forot about that |
18:27:59 | FromDiscord | <iWonderAboutTuatara> I want to declare those params to not have inital values |
18:28:12 | FromDiscord | <iWonderAboutTuatara> and instead just be declared with a type |
18:28:57 | leorize | https://github.com/nim-lang/Nim/commit/57b7841c184e9f185d6d2404a1320e5d089e0e0f <- returning openarray is gonna be possible \o/ |
18:32:30 | FromDiscord | <haxscramper> > I want to declare those params to not have inital values↵@iWonderAboutTuatara you need to add empty node and wrap whole declaration into `VarSection` - https://play.nim-lang.org/#ix=2yWX |
18:32:39 | FromDiscord | <haxscramper> https://nim-lang.org/docs/macros.html#statements-var-section |
18:34:41 | FromDiscord | <iWonderAboutTuatara> I see |
18:34:44 | FromDiscord | <iWonderAboutTuatara> thanks! |
18:36:22 | * | thomasross joined #nim |
18:47:45 | * | pbb quit (Remote host closed the connection) |
18:48:48 | FromDiscord | <iWonderAboutTuatara> how does one make a pragma node? |
18:48:57 | * | pbb joined #nim |
18:49:03 | FromDiscord | <iWonderAboutTuatara> for a newproc, I want to add a pragma |
18:49:19 | disruptek | addPragma |
18:49:38 | disruptek | pragmas are just identifiers. |
18:52:11 | FromDiscord | <iWonderAboutTuatara> `newNimNode(nnkPragma).add(nnkIdent("noSideEffect"))` |
18:52:14 | FromDiscord | <iWonderAboutTuatara> this didn't work |
18:52:36 | FromDiscord | <iWonderAboutTuatara> oh I see |
18:55:06 | disruptek | except when they are symbols. have fun with that. |
18:56:05 | FromDiscord | <iWonderAboutTuatara> wait no nevermind |
18:56:10 | FromDiscord | <iWonderAboutTuatara> that didn't work |
18:56:13 | FromDiscord | <iWonderAboutTuatara> this is so confusing |
18:56:22 | FromDiscord | <iWonderAboutTuatara> disruptek: how do I pass a pragma to newProc? |
18:59:50 | FromDiscord | <Yardanico> https://www.python.org/dev/peps/pep-0638/ |
18:59:54 | FromDiscord | <Yardanico> hehehe |
19:00:14 | FromDiscord | <Yardanico> but they decided to go the Rust way and add ! to signify the use of macros |
19:00:24 | FromDiscord | <iWonderAboutTuatara> not a fan of that |
19:00:34 | FromDiscord | <iWonderAboutTuatara> the idea with macros is to work them in right? |
19:00:39 | FromDiscord | <Yardanico> It's not accepted yet |
19:00:44 | FromDiscord | <iWonderAboutTuatara> oh good |
19:00:58 | FromDiscord | <iWonderAboutTuatara> I don't think signifying that x is a macro is super helpful |
19:01:16 | FromDiscord | <iWonderAboutTuatara> but I really do need to know what is happening here |
19:01:25 | FromDiscord | <Yardanico> well, you can read the proposal |
19:01:29 | FromDiscord | <iWonderAboutTuatara> ```nim result = newProc(name = left[0], params = idefs[0..^1].toSeq, body = fbody,).addPragma(ident("noSideEffect"))``` |
19:01:33 | FromDiscord | <iWonderAboutTuatara> oh not that |
19:01:40 | FromDiscord | <iWonderAboutTuatara> (edit) '```nim result' => '```nim↵result' |
19:01:46 | FromDiscord | <iWonderAboutTuatara> I get a weird error here |
19:02:33 | FromDiscord | <iWonderAboutTuatara> sent a code paste, see https://play.nim-lang.org/#ix=2yXf |
19:02:45 | FromDiscord | <iWonderAboutTuatara> sent a code paste, see https://play.nim-lang.org/#ix=2yXg |
19:03:35 | FromDiscord | <Yardanico> does addPragma return something? |
19:03:43 | FromDiscord | <Yardanico> Doesn't it modify in place? |
19:03:53 | FromDiscord | <iWonderAboutTuatara> wouldn't it take the modified version then? |
19:03:59 | FromDiscord | <iWonderAboutTuatara> oh wait nevermind |
19:04:14 | FromDiscord | <Yardanico> no, this is different |
19:04:29 | FromDiscord | <Yardanico> you need↵result = newProc ..↵result.addPragma ... |
19:04:33 | FromDiscord | <iWonderAboutTuatara> that worked |
19:04:40 | FromDiscord | <iWonderAboutTuatara> and gave way to another confusing error |
19:04:53 | FromDiscord | <Yardanico> well the previous error wasn't really confusing :) |
19:05:06 | FromDiscord | <iWonderAboutTuatara> too many words |
19:05:18 | FromDiscord | <Yardanico> It told you that there's nothing to assign to result because addPragma doesn't return Antony |
19:05:25 | FromDiscord | <Yardanico> (edit) 'Antony' => 'anything else' |
19:05:33 | FromDiscord | <iWonderAboutTuatara> `has no type (or is ambiguous)` |
19:05:35 | FromDiscord | <iWonderAboutTuatara> I missed that |
19:05:46 | FromDiscord | <Yardanico> Well, what's the new error |
19:05:50 | FromDiscord | <iWonderAboutTuatara> that isn't what showed in vscode though, i had to compile to see it |
19:06:01 | FromDiscord | <iWonderAboutTuatara> `Error: type expected, but got: int, a, b, c: int` |
19:06:21 | FromDiscord | <iWonderAboutTuatara> https://play.nim-lang.org/#ix=2yXh |
19:07:02 | FromDiscord | <Yardanico> Well of course |
19:07:24 | FromDiscord | <iWonderAboutTuatara> I'm almost certian I'm missing something obvious here, but I have no clue what it is |
19:07:36 | FromDiscord | <Yardanico> You're not adding proc params properly |
19:08:01 | * | Kaivo quit (Quit: WeeChat 2.9) |
19:08:04 | FromDiscord | <iWonderAboutTuatara> what should I be doing instead? |
19:08:59 | FromDiscord | <iWonderAboutTuatara> I'm more than a bit confused |
19:09:54 | FromDiscord | <Yardanico> Why do you create a varSection? |
19:10:28 | FromDiscord | <iWonderAboutTuatara> I was told this is the correct way to assign a type and not a value |
19:10:54 | FromDiscord | <iWonderAboutTuatara> earlier, the identdefs were saying that `c = int` instead of `c : int` |
19:10:56 | FromDiscord | <Yardanico> but we're doing proc definitions there |
19:11:39 | FromDiscord | <iWonderAboutTuatara> what should I be doing instead? |
19:11:54 | FromDiscord | <iWonderAboutTuatara> I removed the varsec line, somehow works properly |
19:12:13 | FromDiscord | <iWonderAboutTuatara> the error is still there, but it says `a, b, c : int` now |
19:12:32 | FromDiscord | <iWonderAboutTuatara> (edit) '`a,' => '`var int, a,' | 'c :' => 'c:' |
19:12:46 | FromDiscord | <iWonderAboutTuatara> which is confusing, where is the var coming from? |
19:13:03 | FromDiscord | <iWonderAboutTuatara> nevermind, fixed that |
19:13:37 | FromDiscord | <iWonderAboutTuatara> this stuff is confusing, now I'm getting `illformed AST: a` |
19:13:49 | * | kenran joined #nim |
19:14:21 | FromDiscord | <Yardanico> Took me some time since I'm from the phone |
19:14:23 | FromDiscord | <Yardanico> https://play.nim-lang.org/#ix=2yXo |
19:16:04 | FromDiscord | <iWonderAboutTuatara> huh weird |
19:16:13 | FromDiscord | <iWonderAboutTuatara> I don't see anything you're doing too differently |
19:16:42 | FromDiscord | <iWonderAboutTuatara> like obviously your code is just way cleaner and better overall, but interms of what it's doing I don't see the difference |
19:16:44 | FromDiscord | <iWonderAboutTuatara> odd |
19:17:21 | FromDiscord | <iWonderAboutTuatara> oh I see, you explicitly made idefs an @[] |
19:17:26 | FromDiscord | <iWonderAboutTuatara> thanks! |
19:29:08 | * | giannicozy joined #nim |
19:29:28 | giannicozy | Hello, I am just wondering, will version 1.3 be released any time soon? |
19:31:26 | FromDiscord | <Recruit_main707> the way nim versions work is:↵odd versions are stable releases↵and even versions are nightlies, which are essentially released every day or two and are the latest ones (when they are released that is) |
19:31:27 | FromDiscord | <Rika> the next version will be 1.4 |
19:31:48 | FromDiscord | <Rika> even versions are not nightlies? |
19:31:58 | FromDiscord | <Rika> thats backwards |
19:32:32 | FromDiscord | <mratsim> Anyway to have non-inlined const, I get my huge big int arrays duplicated in every file that uses them, meaning everywhere. |
19:32:50 | FromDiscord | <Recruit_main707> the translator switched the orders smh |
19:33:06 | giannicozy | Well, I found a lot of bugfixes for my code in the github, but I don't really want to use a development version yet. I just want to know if I should endure the bugs a little longer or if the stable version is close to ready. |
19:33:38 | FromDiscord | <Recruit_main707> whats wrong with nightlies? |
19:34:18 | FromDiscord | <Recruit_main707> you dont need to clone the code and build it, they are the same as the normal installation |
19:35:42 | * | Trustable quit (Remote host closed the connection) |
19:35:49 | FromDiscord | <iWonderAboutTuatara> wait @Yardanico I'm still super confused |
19:36:12 | FromDiscord | <iWonderAboutTuatara> how are what you did and what I did different? |
19:36:17 | FromDiscord | <iWonderAboutTuatara> https://play.nim-lang.org/#ix=2yXt |
19:36:19 | giannicozy | Oh, well, that's good to know, but I guess I feel a little unsafe using them. I would really like to install the version once and not have to care for a while. But I guess if I want that then I'm not exactly looking for the cutting edge stuff. |
19:36:22 | FromDiscord | <Yardanico> you used toSeq incorrectly |
19:36:32 | FromDiscord | <iWonderAboutTuatara> wdym? |
19:36:39 | FromDiscord | <iWonderAboutTuatara> the reprs of both are the same |
19:36:49 | FromDiscord | <Rika> are the treereprs the same though |
19:37:06 | FromDiscord | <iWonderAboutTuatara> how do I check? |
19:37:07 | FromDiscord | <Yardanico> Well anyway I can't answer now, sorry :) |
19:37:11 | FromDiscord | <iWonderAboutTuatara> no problem |
19:37:20 | FromDiscord | <iWonderAboutTuatara> @Rika using treerepr throws error |
19:37:23 | * | giannicozy quit (Remote host closed the connection) |
19:37:36 | FromDiscord | <Recruit_main707> have you imported macros¿ |
19:37:46 | FromDiscord | <iWonderAboutTuatara> yep |
19:37:51 | FromDiscord | <iWonderAboutTuatara> I sent the nimgrounds link |
19:37:58 | FromDiscord | <iWonderAboutTuatara> https://play.nim-lang.org/#ix=2yXt\ |
19:38:42 | FromDiscord | <Recruit_main707> what should it output? |
19:39:01 | FromDiscord | <iWonderAboutTuatara> it should already work |
19:39:09 | FromDiscord | <iWonderAboutTuatara> I'm just asking what the difference between oldidefs and idefs is |
19:40:32 | FromDiscord | <Rika> @iWonderAboutTuatara https://media.discordapp.net/attachments/371759389889003532/759862053628018718/unknown.png |
19:41:15 | FromDiscord | <iWonderAboutTuatara> how did you echo that? |
19:41:44 | FromDiscord | <Rika> `echo idefs.mapit(it.treerepr)` |
19:41:55 | FromDiscord | <iWonderAboutTuatara> oh I see |
19:42:07 | FromDiscord | <iWonderAboutTuatara> so what's happened here is that the identdefs is after the ident int node? |
19:42:12 | FromDiscord | <iWonderAboutTuatara> so the proc isn't given a return type? |
19:44:23 | FromDiscord | <Rika> proly |
19:47:25 | * | kenran quit (Ping timeout: 240 seconds) |
19:52:44 | FromDiscord | <iWonderAboutTuatara> I see |
19:52:48 | FromDiscord | <iWonderAboutTuatara> this is fun but very confusing |
20:03:41 | FromDiscord | <Yardanico> If you check what params of the proc should be and that newProc accepts openArray for params, it's not confusing :) |
20:08:25 | FromDiscord | <Yardanico> macros docs in the start show AST for most of possible Nim constructs |
20:09:04 | FromDiscord | <iWonderAboutTuatara> I think this is the kind of thing that you only really understand by doing |
20:09:28 | FromDiscord | <iWonderAboutTuatara> I have no experience with metaprogramming before this, so most of this AST manip concepts are new to me |
20:13:56 | * | krux02 quit (Remote host closed the connection) |
20:14:21 | FromDiscord | <Vindaar> > I think this is the kind of thing that you only really understand by doing↵certainly helped me a ton |
20:14:21 | * | krux02 joined #nim |
20:14:24 | FromDiscord | <iWonderAboutTuatara> Sorry if I'm being annoying with all the (relatively) basic questions by the way |
20:14:37 | FromDiscord | <iWonderAboutTuatara> I'll find my feet sooner or later |
20:20:26 | * | pangey quit (Ping timeout: 256 seconds) |
20:21:19 | FromDiscord | <Recruit_main707> i am trying to pass a method as a function pointer so that it is called somewhere else, but the base method keeps getting called, how can i avoid it?↵(code snippet: https://play.nim-lang.org/#ix=2yXI)↵I warn you that the code might not be easy to understand |
20:23:00 | * | pangey joined #nim |
20:24:50 | FromDiscord | <krisppurg> @sealmove[IRC]#0000 i have tried struct.nim however I can't find any `struct_into`. |
20:32:59 | * | narimiran quit (Ping timeout: 265 seconds) |
20:43:36 | * | def- quit (Quit: -) |
20:43:47 | * | def- joined #nim |
20:51:39 | * | a_chou joined #nim |
20:54:38 | * | a_chou quit (Remote host closed the connection) |
20:56:07 | * | MyMind quit (Quit: WeeChat 2.9) |
21:11:07 | * | solitudesf- quit (Ping timeout: 240 seconds) |
21:11:40 | FromDiscord | <lqdev> huh, that's weird. the compiler thinks an object's field doesn't exist for some reason |
21:16:44 | * | arecacea1 quit (Remote host closed the connection) |
21:17:18 | * | arecacea1 joined #nim |
21:18:05 | * | vqrs quit (Ping timeout: 240 seconds) |
21:18:54 | * | Jesin quit (Quit: Leaving) |
21:20:19 | * | vqrs joined #nim |
21:22:31 | * | Jesin joined #nim |
21:36:16 | * | tane quit (Quit: Leaving) |
21:45:01 | FromDiscord | <dom96> It's official https://twitter.com/nim_lang/status/1310334495439171584 |
21:45:31 | FromDiscord | <Avatarfighter> Congrats everyone ! |
21:58:40 | FromDiscord | <exelotl> Nice! :O |
22:12:24 | FromDiscord | <demotomohiro> Congratulations! |
22:58:43 | FromDiscord | <Avatarfighter> I really need to learn what the stuff in the Arraymancer library do because I'm incredibly curious to see what I can do but I'm so lost on where to start |
23:07:06 | FromDiscord | <Vindaar> what are you confused about? |
23:07:20 | FromDiscord | <Vindaar> Feel free to ask as many questions as necessary |
23:09:51 | FromDiscord | <Avatarfighter> I guess I'm confused about where I can start learning about wtf a tensor is and how do they allow for deep learning |
23:10:19 | FromDiscord | <Avatarfighter> I can write myself little programs with the arraymancer library I just don't understand why something does what it does lol |
23:13:26 | FromDiscord | <Vindaar> Hmm, well. How much math do you know or enjoy? |
23:13:36 | FromDiscord | <Avatarfighter> Oh gosh |
23:14:16 | FromDiscord | <Avatarfighter> Well I enjoy learning Math, I'm just pretty terrible at it lol |
23:14:49 | FromDiscord | <Avatarfighter> I'm still in high school so I wouldn't say that I know that much math when you think about math as a whole |
23:15:28 | FromDiscord | <Vindaar> Focus on the enjoy aspect. That you're bad at it is most likely just your view on yourself based on learning "math" in a rather bad way |
23:15:56 | FromDiscord | <Vindaar> If you're in high school I assume you know what a matrix is? |
23:16:01 | FromDiscord | <Avatarfighter> I do yes 🙂 |
23:17:16 | FromDiscord | <Avatarfighter> tbh I am bad at math because of the way I was taught to take notes, I recently just switched the style for my notes and math is a whole new subject for me lmao |
23:17:45 | FromDiscord | <Vindaar> ok! In the simplest explanation a tensor as nothing but a generalization of the concept:↵scalar -> vector -> matrix -> ...↵Each can be thought of as a tensor of a certain rank |
23:17:55 | FromDiscord | <Vindaar> that's good to hear! |
23:18:36 | FromDiscord | <Vindaar> And tensors then allow you to have objects with higher rank ("higher dimensionality") essentially |
23:19:18 | FromDiscord | <Avatarfighter> Ohhh |
23:19:25 | FromDiscord | <Vindaar> e.g. a tensor of rank 3 is somewhat like a 3D matrix. Take a look here: https://en.wikipedia.org/wiki/Levi-Civita_symbol#/media/File:Epsilontensor.svg |
23:21:27 | FromDiscord | <Vindaar> well, technically the levi-civita symbol is _not_ a tensor, but that's precisely where tensors in computer science and maths typically lose their equivalence (a tensor is only specific kind of object, that transforms in a specific way under a coordinate transformations, which interestingly enough one of the main ingredients as to why general relativity is so hard mathematically, haha) |
23:22:06 | FromDiscord | <Vindaar> for CS you can really just think of a tensor as an N dimensional matrix |
23:23:23 | FromDiscord | <Avatarfighter> I'm doing more research into this |
23:23:26 | FromDiscord | <Avatarfighter> this is so cool!! |
23:23:31 | FromDiscord | <Vindaar> it is 🙂 |
23:24:11 | * | ehmry quit (Ping timeout: 272 seconds) |
23:25:21 | FromDiscord | <Vindaar> but this makes me realize right now how much stuff I have forgotten already 😦 |
23:25:32 | * | ehmry joined #nim |
23:25:36 | FromDiscord | <Avatarfighter> Thanks for explanation Vindaar, I'm going to see if I can find an explanation on how ranking in nd-arrays work lol |
23:25:43 | FromDiscord | <Avatarfighter> n-dimensional arrays ig |
23:25:53 | FromDiscord | <Avatarfighter> or rather tensors(?) |
23:26:49 | FromDiscord | <Vindaar> well, that's the thing. I think many people just say nd-arrays to make it clearer that we aren't talking about mathematical tensors (at least not always) |
23:28:11 | * | mmohammadi98129 quit (Ping timeout: 258 seconds) |
23:28:38 | FromDiscord | <Vindaar> if you want to look at something, which is probably too crazy, but imo one of the best introductions to the math of tensors (from a practical point of view, it's not as rigorous as a mathematician might like), check out the beginning of Sean Carroll's notes on GR here:↵https://arxiv.org/pdf/gr-qc/9712019.pdf↵If you're anything like me seeing something like that might be inspiring 🙂 |
23:29:02 | FromDiscord | <Vindaar> page 13 introduces tensors |
23:29:30 | FromDiscord | <Avatarfighter> I'll check it out 🙂 Wow this just puts into perspective how little I know about stuff and how hard it is for me to find information explained plainly on it. |
23:30:15 | FromDiscord | <Vindaar> I don't want to depress you, but... I feel the exact same to this day. I always though that feeling might disappear after studying physics. And it never did |
23:30:41 | * | abm quit (Read error: Connection reset by peer) |
23:30:58 | FromDiscord | <Vindaar> There's just too much stuff out there, that's too hard to grasp and only so little time... And as I mentioned, one forgets stuff too quickly, sigh |
23:31:27 | FromDiscord | <Avatarfighter> I run into this feeling quite a bit when doing "regular" programming lol |
23:31:30 | FromDiscord | <Vindaar> (doesn't mean I didn't learn _a lot_ and it wasn't worth it or something) |
23:31:42 | FromDiscord | <Vindaar> haha, happens to me too! 😄 |
23:33:04 | FromDiscord | <Avatarfighter> I'm excited to get a higher education, I aspire to be at the point where I know the proper terms to search for on google sometimes its a bit awkward trying to find structures that are specialized when you don't actually know the name |
23:33:40 | FromDiscord | <Vindaar> oh yes, it really is. That's why education is worth so much. Helps with _knowing where to find stuff_ |
23:33:57 | FromDiscord | <Avatarfighter> I think I spent a couple days learning that a Patricia tree is a thing lol |
23:34:10 | FromDiscord | <Vindaar> no idea what that is 🙃 |
23:34:19 | FromDiscord | <Vindaar> oh a trie |
23:34:23 | FromDiscord | <Avatarfighter> Its a Radix tree |
23:34:25 | FromDiscord | <Avatarfighter> yeah |
23:35:07 | FromDiscord | <Avatarfighter> Its a really space efficient trie for strings that have common prefixes and I spent wayyy too long looking for the correct term |
23:35:36 | FromDiscord | <Vindaar> that's pretty cool |
23:35:43 | FromDiscord | <Vindaar> not the looking long part though |
23:36:06 | FromDiscord | <Avatarfighter> 🤷♂️ it is what it is |
23:36:19 | FromDiscord | <Vindaar> ok, anyways. I need to go to bed. ↵In case you have any mathy (programming related maybe) questions, feel free to ping me! |
23:36:33 | FromDiscord | <Avatarfighter> I will, thank you very much for the explanation and the help Vindaar 🙂 |
23:36:59 | FromDiscord | <Vindaar> you're very welcome! |
23:40:28 | FromDiscord | <exelotl> woahh I understand what a tensor is now |
23:41:22 | FromDiscord | <Avatarfighter> right ?? lol |
23:41:34 | FromDiscord | <Avatarfighter> I thought it was something scary not a N-dimensional array |
23:44:38 | FromDiscord | <InventorMatt> i am trying to test out concepts and and I am getting an error even though the variable should pass all of the tests. any help to fix it or to know if it is impossible would be appreciated. https://play.nim-lang.org/#ix=2yYv |
23:50:39 | FromDiscord | <exelotl> @InventorMatt concepts are only able to express compile-time facts about a type, but here you're trying to use them to express runtime facts about an instance of that datatype |
23:51:13 | FromDiscord | <exelotl> (edit) 'that datatype' => 'a type' |
23:51:27 | FromDiscord | <InventorMatt> okay, that makes sense. thanks |
23:52:34 | FromDiscord | <exelotl> np :) |
23:53:56 | FromDiscord | <InventorMatt> is there a way to express runtime facts about an instance for a proc input. like for example only allowing unit vectors for the input? |
23:56:05 | FromDiscord | <exelotl> only with runtime checks, for example you could throw an exception if the magnitude is not approximately equal to 1 |
23:56:49 | FromDiscord | <exelotl> but, if you know you're passing a constant value you can do compile time checks on it, I'll cook up an example |