00:20:56 | * | fowl quit (Read error: Connection reset by peer) |
00:25:04 | * | Trixar_za is now known as Trix[a]r_za |
01:13:35 | * | fowl joined #nimrod |
01:28:46 | * | erlnoob joined #nimrod |
02:22:38 | * | Trix[a]r_za is now known as Trixar_za |
03:01:12 | * | Boscop quit (Read error: Connection reset by peer) |
03:02:30 | * | Boscop joined #nimrod |
03:35:07 | * | Trixar_za is now known as Trix[a]r_za |
03:49:54 | * | OrionPK quit (Quit: Leaving) |
03:57:38 | * | fowl quit (Ping timeout: 258 seconds) |
04:02:05 | * | fowl joined #nimrod |
07:33:27 | * | fowl quit (Ping timeout: 258 seconds) |
07:38:44 | * | fowl joined #nimrod |
08:26:43 | * | erlnoob quit (Quit: erlnoob) |
09:05:34 | * | fowl_ joined #nimrod |
09:05:46 | * | fowl_ quit (Remote host closed the connection) |
10:48:33 | * | fowl quit (Ping timeout: 258 seconds) |
10:57:14 | * | xcombelle joined #nimrod |
11:22:06 | * | Roin_ joined #nimrod |
11:26:52 | * | comex` joined #nimrod |
11:29:18 | * | reactormonk quit (*.net *.split) |
11:29:19 | * | Roin quit (*.net *.split) |
11:29:19 | * | comex quit (*.net *.split) |
11:30:09 | * | reactormonk joined #nimrod |
11:34:05 | * | Roin_ is now known as Roin |
11:48:38 | * | Trix[a]r_za is now known as Trixar_za |
12:13:34 | * | q66 joined #nimrod |
12:55:34 | * | XAMPP joined #nimrod |
12:55:34 | * | XAMPP quit (Changing host) |
12:55:34 | * | XAMPP joined #nimrod |
14:04:20 | * | XAMPP_ joined #nimrod |
14:07:53 | * | XAMPP quit (Ping timeout: 258 seconds) |
15:09:40 | dom96 | hello |
15:13:59 | reactormonk | morning |
15:18:22 | * | comex` is now known as comex |
16:32:44 | * | Trixar_za is now known as Trix[a]r_za |
17:14:43 | * | zahary_ quit (Read error: Connection reset by peer) |
17:15:30 | * | zahary_ joined #nimrod |
17:29:24 | * | fowl joined #nimrod |
18:21:49 | * | zahary joined #nimrod |
18:28:38 | * | xcombelle quit (Remote host closed the connection) |
18:48:19 | fowl | type TMaybe*[T] = tuple[has: bool, val: T] |
18:51:21 | dom96 | https://gist.github.com/dom96/5462115 |
18:52:05 | fowl | i like that |
18:52:16 | * | apotheon quit (Read error: Connection reset by peer) |
18:52:23 | * | apotheon joined #nimrod |
18:52:23 | * | apotheon quit (Changing host) |
18:52:23 | * | apotheon joined #nimrod |
18:52:39 | dom96 | Inspired by haskell ;) |
18:53:53 | * | Roin quit (Ping timeout: 240 seconds) |
18:56:31 | fowl | that is not very safe though |
18:56:47 | fowl | i just hit enter and got Error: unhandled exception: value is not accessible [EInvalidField] |
18:57:35 | dom96 | indeed. that's just testing code. |
18:57:52 | dom96 | I haven't fully developed it |
18:58:06 | dom96 | also that code is probably at least a year old :P |
18:58:37 | dom96 | you need a way to get the value out of it safely. |
18:58:39 | fowl | in haskell how do you use it? i cant read haskell at all, needs more parens or something |
18:59:03 | * | Roin joined #nimrod |
18:59:15 | dom96 | in haskell you would pattern match to retrieve the value |
18:59:28 | dom96 | or have functions which work on the Maybe |
19:00:06 | dom96 | It should be composable. |
19:00:12 | dom96 | so |
19:00:17 | fowl | no idea what that means |
19:00:24 | fowl | sry |
19:00:41 | dom96 | You should implement something like: |
19:01:31 | dom96 | hrm. |
19:02:01 | dom96 | proc `>>`[T](m: TMaybe[T], m2: TMaybe[T]): TMaybe[T] |
19:02:30 | dom96 | safeReadLine() >> safeAdd("blah") |
19:02:47 | dom96 | If m is Nothing then it should simply return Nothing. |
19:03:24 | dom96 | er, hrm |
19:03:30 | dom96 | no that doesn't make sense lol |
19:03:58 | dom96 | It should work on functions. |
19:04:38 | dom96 | proc `>>`[T](m: proc (): TMaybe[T], m: proc (): TMaybe[T]): TMaybe[T] |
19:04:47 | dom96 | But we would need currying first. |
19:05:09 | dom96 | It really makes more sense in Haskell |
19:05:12 | fowl | i like this better its shorter :) https://gist.github.com/fowlmouth/5462239 |
19:05:16 | dom96 | because of the way Haskell does currying |
19:06:29 | dom96 | In Haskell Maybe is a monad... |
19:06:37 | dom96 | So it works well with everything else. |
19:07:28 | dom96 | might want to set has to true when assigning :P |
19:07:42 | fowl | yea i forgot about that |
19:07:45 | dom96 | I prefer my approach with the object variant. |
19:07:58 | dom96 | Your approach will hide errors. |
19:07:58 | fowl | i thought the goal for maybe was just to guard it |
19:08:37 | dom96 | Maybe, I dunno. |
19:09:04 | fowl | maybe[t] doesnt have to be immutable, you should be able to set/unset it imo |
19:09:14 | reactormonk | fowl, you know, you can also have TEither with T and Unit |
19:09:22 | dom96 | I don't see the point. |
19:09:28 | dom96 | You can just use Just :P |
19:10:25 | dom96 | fowl: If you feel like playing around, you should try to write a curry macro. |
19:13:06 | fowl | dom96: this is currying right https://gist.github.com/fowlmouth/5462316 |
19:14:04 | dom96 | pretty much |
19:14:19 | dom96 | but it shouldn't be restricted to that proc type |
19:14:27 | dom96 | which is why a macro is necessary I guess |
19:14:28 | fowl | yea |
19:14:36 | fowl | i can write a macro for that :> |
19:15:26 | dom96 | cool |
19:16:24 | dom96 | hrm, interesting. |
19:17:09 | fowl | dom96: hey do you know how to get someones host name from an async socket |
19:17:24 | dom96 | use acceptAddr |
19:18:50 | dom96 | gah, doc gen for the sockets module is broken. |
19:19:15 | dom96 | There is another function which you need to use to transform the IP address that you get from acceptAddr into a hostname |
19:19:28 | fowl | asyncio has broken docs too |
19:19:42 | dom96 | getHostByAddr IIRC |
19:23:09 | fowl | cool thanks |
19:28:43 | fowl | i dont think i can use a macro |
19:29:00 | dom96 | why? |
19:29:02 | fowl | given curry(foo, args..) i dont have a way to find out what foo is unless its a literal proc |
19:29:41 | fowl | however with curry generics with 1-9 generic params you could probably curry any function |
19:30:06 | dom96 | Yeah, but that's a bit bleh. |
19:30:13 | dom96 | Wait until Araq shows up and ask him. |
19:44:35 | fowl | hm i have problems when trying to curry a function that returns void |
19:45:56 | fowl | curry[int, void](squaz, 9001)() works but curry(squaz, 9001)() is a no-go =( |
19:50:25 | dom96 | that kinda sucks :\ |
19:50:50 | reactormonk | fowl, can't you ask the compiler for type information? |
19:51:28 | fowl | reactormonk: its not matching the function to the generic |
19:53:13 | fowl | ah it matches proc curry[A] (func: proc(someA: A), valueA: A): proc() |
19:53:25 | fowl | that will be annoying to have a no-return variant for each of these |
19:59:20 | dom96 | yeah, which is why we should just have a macro :P |
20:30:04 | fowl | if its possible to get the info needed and match to the right function, sure |
20:35:19 | * | zahary quit (Quit: Leaving.) |
21:01:06 | dom96 | fowl: how far are you planning to take your ircd? |
21:14:01 | fowl | probably just basic functionality |
21:14:08 | * | Amrykid_ joined #nimrod |
21:15:34 | * | Amrykid quit (*.net *.split) |
21:19:03 | Araq | I'm here now |
21:19:25 | Araq | what's the question? |
21:20:19 | dom96 | read the log, there isn't much of it. |
21:20:30 | Araq | and why don't people get that currying is trivial in every language with closures: f(x, y) = f_x(y) |
21:21:45 | dom96 | sure it's "trivial", but it requires you to write way too much code to accomplish. |
21:22:56 | fowl | this is my solution https://gist.github.com/fowlmouth/5462316 there's a problem that functions returning void dont match so it would require duplicates for void functions |
21:26:15 | Araq | fowl: looks easy to support, make a bug report please |
21:26:34 | Araq | in fact, it looks like 1 missing line in the compiler :-) |
21:27:22 | fowl | ok |
21:27:37 | fowl | is there a limit for generics |
21:29:06 | Araq | well we don't have variadic generics yet as you noticed ;-) |
21:29:27 | Araq | there is no limit in the compiler though |
21:31:23 | dom96 | what about implementing this curry as a macro? |
21:32:00 | Araq | what about it? should be possible |
21:32:07 | dom96 | read the logs |
21:33:30 | * | Amrykid_ is now known as Amrykid |
21:34:25 | Araq | well the macros API is missing a 'getProcBody(s: PSym)' then |
21:34:46 | Araq | or rather a getProcImpl() |
21:34:59 | Araq | which would include the parameter list |
21:35:13 | fowl | only need the params and return type i think |
21:35:18 | * | Amrykid quit (Changing host) |
21:35:18 | * | Amrykid joined #nimrod |
21:36:10 | Araq | yeah but getProcImpl is more flexible :P |
21:41:08 | reactormonk | Araq, getProcImpl and getProcSig? |
21:41:58 | Araq | getProcSig(n) = getProcImpl(n)[2] |
21:42:10 | fowl | yea that would be dope |
21:42:25 | reactormonk | Araq, so you don't have to look up the magic number 2 |
21:42:39 | fowl | fuzz reflection, i could do miracles with compile-time introspection |
21:43:03 | Araq | reactormonk: yes sure, however macros.nim mostly gives you the bare bones |
21:43:29 | Araq | we have macros_dsl to hide the magic numbers |
21:43:38 | reactormonk | kk |
21:44:41 | Araq | somehow nobody gets the real point behind the macros api :P |
21:44:50 | reactormonk | ^^ |
21:44:59 | Araq | the compiler itself uses the very same AST |
21:45:19 | Araq | which means once you mastered it, the step to become a compiler dev is small :P |
21:46:01 | fowl | Araq: building the nodes with macros.add is archaic and tedious, requiring you to declare each small part |
21:46:20 | fowl | please make add() function like my und() |
21:46:36 | Araq | he he, that's what I wanted to do |
21:46:47 | Araq | and I know that it's tedious |
21:47:56 | Araq | the macros.nim is mostly an experiment; it's never really been designed |
21:48:34 | fowl | is the dsl in stdlib now |
21:48:46 | Araq | I guess it was so hard to implement that that used up all of my brain :P |
21:49:20 | Araq | and no, it's still not in the stdlib, sorry |
21:49:21 | fowl | i looked at the impl of mAdd, code is scary >_> |
21:49:29 | reactormonk | fowl, ^^ |
21:49:39 | reactormonk | I take > 10 lines as scary |
21:50:11 | Araq | fowl: as I said, it was mostly an experiment ... |
21:51:23 | Araq | I wondered if it can be made to work this way :P |
21:51:41 | fowl | you could rename it to addNode and add und as add |
21:51:52 | Araq | no need |
21:52:02 | Araq | the builtin add can easily return the node |
21:52:12 | Araq | and be .discardable of course |
21:54:02 | Araq | fowl: try this: replace 'result = emptyNode' with 'result = a' in evals.nim:1102 |
21:54:13 | Araq | same for mNAddMultiple |
21:54:24 | Araq | change the prototypes in macros.nim |
21:54:29 | Araq | and try it out please |
21:54:36 | Araq | if it works, make a pull request |
21:54:50 | fowl | ok |
21:55:03 | Araq | I'm busy rewriting the JS backend |
21:56:44 | reactormonk | \o/ |
21:57:14 | Araq | reactormonk: if you want to help with it you better learn luajit ;-) |
21:57:41 | Araq | because it's soon a luajit code generator at the same time |
21:57:58 | fowl | neat :] |
22:03:42 | reactormonk | Araq, luajit? Never heard of. |
22:03:55 | Araq | lol |
22:04:44 | Araq | yeah, a JIT for a dynamic language that generates on par code with GCC for floating point stuff ... why should you have heard of it? :P |
22:06:51 | reactormonk | not bad |
22:27:49 | dom96 | Araq: I think the newparser branch breaks docgen for sockets/asyncio |
22:28:41 | Araq | yeah haven't checked docgen with it |
22:33:58 | * | OrionPK joined #nimrod |
22:34:37 | * | Trix[a]r_za is now known as Trixar_za |
23:30:23 | * | q66 quit (Remote host closed the connection) |