« Back to channel list

#ruby-offtopic - 30 November 2017

« Back 1 day Forward 1 day »
[00:26:36] tcopeland: has joined #ruby-offtopic
[00:31:33] Technodrome: has joined #ruby-offtopic
[02:41:15] workmad3_: has joined #ruby-offtopic
[03:10:45] Exhiled: has joined #ruby-offtopic
[03:46:55] eckhardt: has joined #ruby-offtopic
[04:26:10] dminuoso: Or let me share it here rather:
[04:26:13] dminuoso: havenwood, baweaver: https://ro-che.info/ccc/8
[06:42:01] RickHull: any Traveller fans in the house? (tabletop gaming)
[06:42:10] RickHull: leitz hasn't been back in a while but I want to show off
[07:03:21] eckhardt: has joined #ruby-offtopic
[07:37:06] baweaver: didn't think there was
[07:37:13] dminuoso: !shoot baweaver
[07:37:20] dminuoso: !radarsnack
[07:37:37] dminuoso: Is whitelisting channel specific?
[07:37:55] RickHull: DeBot_: hangman dminuoso
[07:38:04] RickHull: DeBot_: !hangman ruby
[07:38:04] DeBot_: ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣ [] 0/12 (ruby)
[07:38:18] DeBot_: ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣ [:] 1/12 (ruby)
[07:38:44] DeBot_: ␣␣␣␣␣␣␣␣␣␣_␣␣␣␣␣␣␣␣␣ [:] 1/12 (ruby)
[07:39:04] DeBot_: ␣␣␣#␣␣␣␣␣␣_␣␣␣␣␣␣␣␣␣ [:] 1/12 (ruby)
[07:39:17] RickHull: DeBot_: aeo
[07:39:17] DeBot_: ␣e␣#␣␣o␣e␣_␣␣␣e␣␣e␣␣ [:a] 2/12 (ruby)
[07:46:58] DeBot_: ␣e␣#␣␣o␣e␣_␣␣␣e␣␣e␣␣ [:a] 2/12 (ruby)
[07:47:25] diana_fire: dminuoso: hey baby
[07:50:21] DeBot_: ␣e␣#␣␣o␣e␣_␣␣␣e␣␣e␣␣ [:ai] 3/12 (ruby)
[07:50:27] DeBot_: ␣e␣#␣␣o␣e␣_␣u␣e␣␣e␣␣ [:ai] 3/12 (ruby)
[07:57:42] burgestrand: has joined #ruby-offtopic
[08:09:54] dminuoso: https://gist.github.com/dminuoso/727232327fa37b65ed2474348572d622
[08:10:05] dminuoso: Ive actually stared at this for a minute to realize what went wrong.
[08:48:11] eckhardt: has joined #ruby-offtopic
[09:40:48] helpa: has joined #ruby-offtopic
[10:02:49] ruby[bot1: has joined #ruby-offtopic
[10:02:49] ChanServ: +o ruby[bot1
[10:03:51] Yxhvd: has joined #ruby-offtopic
[10:09:03] TvL: has joined #ruby-offtopic
[11:08:49] lupine: has joined #ruby-offtopic
[11:13:03] mikecmpbll: has joined #ruby-offtopic
[11:17:09] MartesZibellina: has joined #ruby-offtopic
[11:22:41] apeiros_: has joined #ruby-offtopic
[11:29:45] naprimer: has joined #ruby-offtopic
[12:27:22] haylon: has joined #ruby-offtopic
[12:42:06] apeiros: is it whataboutism if when reading https://12factor.net/port-binding I ask "what about sockets?"?
[12:49:47] mikecmpbll: has joined #ruby-offtopic
[14:13:31] apeiros: has joined #ruby-offtopic
[14:14:05] apeiros: ooookay, so the downside of using your mobile as hotspot for your private laptop at work is obviously: can't just pick up a call and walk away :D
[14:18:37] Technodrome: has joined #ruby-offtopic
[16:22:36] dminuoso: havenwood: :|
[16:22:40] dminuoso: Yeah obvious troll.
[16:22:50] havenwood: Last time PHP was statically typed. >.>
[16:23:00] dminuoso: havenwood: Strictly speaking Ruby is statically typed too.
[16:23:15] dminuoso: You know that right? :)_
[16:24:42] dminuoso: 17:24 gizmore | i was thinking of typescript or c++
[16:24:55] dminuoso: havenwood: This is so terrible. It was my bad, we shouldn't have fed him.
[16:26:58] dminuoso: havenwood: In all fairness, an ex co-worker is working for a large enterprise that a rather expensive successful enterprise product
[16:27:13] dminuoso: It's a really complex rule engine managing permissions, accounts, etc
[16:27:25] dminuoso: It's written in... database triggers. I shit you not.
[16:27:48] dminuoso: They actually have to run this on machines with 128GiB RAM and 48 cores just to make this run fast.
[16:28:26] dminuoso: Which you know, can be really impressive because it it makes it sound like heavy duty stuff, justifying their high prices
[16:31:12] apeiros: has joined #ruby-offtopic
[17:24:34] apeiros: has joined #ruby-offtopic
[19:48:24] haylon: has joined #ruby-offtopic
[19:57:44] dminuoso: Stop messing with my head :(
[20:17:55] burgestrand: has joined #ruby-offtopic
[20:32:51] RickHull: has joined #ruby-offtopic
[20:45:38] al2o3-cr: has joined #ruby-offtopic
[21:09:18] dminuoso: RickHull: Oh man Im falling in love with this language.
[21:10:45] dminuoso: RickHull: https://gist.github.com/dminuoso/9f960b7078488e7b1444a7ac82d02bca
[21:11:32] dminuoso: This is some very succint code that just converts an expression tree of say (Add (Var "x") (Mul (Lit 1) (Lit 2))
[21:11:47] dminuoso: In a very elegant way to paranthesize everything that needs it due to precedence.
[21:11:55] dminuoso: (Into a string)
[21:12:22] dminuoso: GHCi λ putStrLn $ show (Div (Lit 1) (Add (Lit 2) (Lit 3))) # => 1 / (2 + 3)
[21:13:44] RickHull: what do the 6 and 7 indicate?
[21:13:59] dminuoso: Precedence levels
[21:14:07] RickHull: and isn't the precedence shown by parens in the expression tree?
[21:14:32] dminuoso: RickHull: No. The expression tree is just a construct.
[21:14:45] dminuoso: Its just data constructors that dont have precedence
[21:14:49] RickHull: that is -- are you defining division to have higher precedence than addition?
[21:15:07] RickHull: the expression tree should be fine without operator precedence
[21:15:30] dminuoso: The way to read this is a bit weird because of the pattern, I think I still have a bug in it. ;-)
[21:15:32] dminuoso: The point is
[21:15:37] dminuoso: What if you want to print that expression tree
[21:15:44] dminuoso: With as few parens as necessary
[21:17:22] dminuoso: Ohh but yeah, division has higher precedence that was an incorrect answer.
[21:17:34] dminuoso: As it should, like multiplication
[21:17:53] dminuoso: 1 + 2 * 3 should be 1 + (2 * 3)
[21:18:02] dminuoso: just like 1 + 2 / 3 should be 1 + (2 / 3)
[21:18:12] RickHull: well, why should it? just tradition?
[21:18:21] dminuoso: Yeah. But of course I have the freedom to change that.
[21:18:54] dminuoso: Which by the way is interesting, since you can create almost any operator in Haskell itself. And best of it, you can also set its precedence, and whether its left or right associative :-)
[21:20:21] RickHull: i keep leaning towards being more explicit for the reader's sake -- that sexps (e.g.) are unambiguous
[21:20:49] RickHull: i.e. not requiring the reader to have the precedence table loaded in brain
[21:21:14] RickHull: some level of ambiguity improves clarity, of course
[21:21:15] dminuoso: RickHull: Well in all fairness all the regular ones are slowly starting to burn in mind, and for all the non-casual stuff you can always quickly look it up
[21:21:41] dminuoso: RickHull: https://gist.github.com/dminuoso/751604902bf242afc7514ef6a0e6fb04
[21:22:30] dminuoso: RickHull: Well there's certain tricks actually using the flexible precedence system
[21:24:27] dminuoso: f $ x = f x
[21:24:45] dminuoso: Defines an infix operator that takes a function and a value, and applies it
[21:24:52] dminuoso: so if you do f $ x its the same as just doing f x
[21:24:59] dminuoso: Which seems like a pointless excercise.
[21:25:01] dminuoso: Until you see:
[21:25:15] dminuoso: Which declares this operator to have lowest precedence possible and be right associative.
[21:26:54] dminuoso: showParen (d > 7) $ showsPrec 6 a . showString " / " . showsPrec 7 b
[21:27:03] dminuoso: showParen (d > 7) (showsPrec 6 a . showString " / " . showsPrec 7 b)
[21:27:06] dminuoso: I like the first more
[21:27:44] RickHull: i can hardly read either one ;)
[21:28:20] dminuoso: . is just function composition =)
[21:28:34] RickHull: what is `show` vs `shows` ? something significant?
[21:29:48] dminuoso: Yeah. So basically the way you "show" (to_s) something with a recursive structure, is by turning something like a(b(c)) into show a ++ (show b ++ show c) right?
[21:30:45] dminuoso: Now the problem is, for a lot of interesting reasons standard lists are implemented as singly linked lists. So that has quadratic complexity O(n^2) for a recursive structure with depth n
[21:30:59] dminuoso: or rather a recursive structure with a string that appraoches n length
[21:32:04] dminuoso: So basically (a ++ b) ++ c is inefficient, but a ++ (b ++ c) is not
[21:32:28] RickHull: what is ++?
[21:32:46] RickHull: does the inefficiency hinge on the nature of ++ ?
[21:33:11] RickHull: list constructor?
[21:33:31] dminuoso: ++ is list concatenation
[21:33:38] dminuoso: RickHull: the problem is the linked list.
[21:33:51] dminuoso: appending things to the tail is easy
[21:33:59] dminuoso: because you have to traverse the entire list
[21:34:04] dminuoso: but the head is easy
[21:34:13] dminuoso: So the trick is to turn it into a pattern: (x ++) . (y ++) . (z ++)
[21:34:26] dminuoso: and thats shows
[21:34:57] dminuoso: (x ++) is just partial application (currying)
[21:36:08] dminuoso: So you just create a composed list of functions that append some string to the front of something
[21:36:38] dminuoso: Once its done, you just call it with say just "", and it will bit by build append the string from the head side
[21:36:49] dminuoso: *bit by bit
[21:37:18] RickHull: makes sense enough. build the string by describing it as a sequence of operations, and then you don't have to walk it
[21:38:45] dminuoso: RickHull: (/4) by the way is partial application of the / (division) operator. It creates a function that when applied to a number, will divide that number by 4.
[21:38:59] dminuoso: Likewise (4/) creates a function that when applied to a number, will divide 4 by that number.
[21:39:06] dminuoso: currying is amazing :)
[21:39:22] dminuoso: Id love this in ruby
[21:39:52] RickHull: that's a good example for showing how to reduce big O complexity without changing the data structure
[21:40:06] RickHull: my first inclination would be to use a doubly linked liist
[21:40:43] RickHull: there's a bit of a tradeoff though, for needing a "trick"
[21:41:11] RickHull: i wonder how my brain implements a list ;)
[21:41:12] dminuoso: RickHull: Well there's a deeply mathematical reason to use a singly linked list.
[21:41:23] dminuoso: Its not meant to be used for storing data in actual performance situations.
[21:41:26] RickHull: i can add to the head or a tail of a list O(1)
[21:42:28] dminuoso: RickHull: The point is, a list [1,2,3,4] is actually desugared into 1:(2:(3:(4:[])))
[21:42:35] dminuoso: (that is actually what haskell sees)
[21:42:43] RickHull: much like lisp, the list processor ;)
[21:42:54] dminuoso: Exactly. The reason lisp did it was exactly the same.
[21:43:14] dminuoso: : is even referred to as "cons" :-)
[21:43:42] RickHull: i can't remember the origin of that term, or car/cdr
[21:43:46] RickHull: I knew once
[21:44:00] RickHull: ha, i called it a list constructor above
[21:44:33] dminuoso: RickHull: Once you see that structure, reduce becomes to be very special.
[21:44:49] dminuoso: This is what reduce does: https://wiki.haskell.org/wikiupload/3/3e/Right-fold-transformation.png
[21:45:20] dminuoso: Or actually ruby is foldl: https://wiki.haskell.org/wikiupload/5/5a/Left-fold-transformation.png
[21:45:58] dminuoso: Such beauty >:)
[21:46:54] RickHull: i gotta run for a bit
[21:52:04] eckhardt: has joined #ruby-offtopic
[22:03:32] eckhardt: has joined #ruby-offtopic
[22:04:53] eckhardt_: has joined #ruby-offtopic
[22:18:46] Technodrome: has joined #ruby-offtopic
[22:25:18] baweaver: dminuoso: We found something fun
[22:25:29] baweaver: Matz just gave you a Christmas present
[22:25:44] baweaver: https://bugs.ruby-lang.org/issues/11286#note-16
[22:26:20] dminuoso: baweaver: Ox0dea would be thrilled if he hadnt left the community.
[22:26:35] dminuoso: Been waiting for this to happen for a long while now.
[22:27:59] dminuoso: baweaver: addrs.any? IPAddr.new("")
[22:28:03] dminuoso: Going to be fun
[22:28:12] baweaver: want to know something else fun?
[22:28:19] baweaver: IPAddr takes subnet masks
[22:28:45] dminuoso: I can barely tell the difference between an A record and CIDR.
[22:29:26] baweaver: dminuoso https://medium.com/rubyinside/triple-equals-black-magic-d934936a6379
[22:30:18] dminuoso: -> a { a > 5 } === 6
[22:30:28] dminuoso: >> -> a { a > 5 } === 6
[22:30:33] dminuoso: ACTION kicks ruby[bot1
[22:30:36] dminuoso: >> -> a { a > 5 } === 6
[22:30:41] dminuoso: ACTION hits ruby[bot1 with apeiros
[22:31:22] dminuoso: baweaver: Thats a great article.
[22:31:33] eckhardt: has joined #ruby-offtopic
[22:32:16] baweaver: Rambda returns Procs for things
[22:32:18] baweaver: which means....
[22:34:56] dminuoso: baweaver: rambda-ruby has some annoying properties..
[22:35:03] dminuoso: Ones that I will address.
[22:35:26] dminuoso: Procs, no proper currying
[22:35:29] dminuoso: R.compose(R.add, R.add).(1, 2, 3, 4, 5, 6)
[22:36:03] dminuoso: Q will allow: (Q.add * Q.add).(1, 2, 3)
[22:39:13] dminuoso: (Q.add * Q.add(1)).(2, 3) that is
[22:39:51] RickHull: baweaver: hmmm ('1.0.0'..'2.0.0') === '1.2.3'
[22:40:07] RickHull: ('1.0.0'..'2.0.0') === '1.2.34' # false
[22:40:23] baweaver: that one's not exactly sane
[22:40:39] RickHull: it's just lexographic right?
[22:41:02] RickHull: hm, probably not
[22:54:35] dminuoso: baweaver: New pattern found!
[22:54:42] dminuoso: Q.map(Q.map(Q.map))
[22:55:00] dminuoso: Holy. There's like an infinite well of crazy combinators.
[22:55:18] baweaver: boats boats boats?
[22:55:43] dminuoso: well its the same as: Q.map * Q.map
[22:56:54] dminuoso: Or Q.compose(Q.compose, Q.compose)
[22:59:35] kapil___: has joined #ruby-offtopic
[23:04:47] RickHull: '1.4.9'.next # what is this based on?
[23:05:07] RickHull: https://ruby-doc.org/core-2.4.1/String.html#method-i-next
[23:05:40] RickHull: "If the increment generates a “carry,'' the character to the left of it is incremented. This process repeats until there is no carry, adding an additional character if necessary."
[23:06:07] RickHull: '.' is obviously significant but undocumented
[23:06:16] RickHull: '.'.next #=> '/'
[23:06:53] RickHull: "Incrementing nonalphanumerics uses the underlying character set's collating sequence." not sure what this implies
[23:22:42] RickHull: I believe this behavior would be documented if it said: "If the increment generates a carry, the alphanumeric to the left of it is incremented"
[23:22:55] RickHull: but I'm not sure if that behavior holds either
[23:23:56] RickHull: '...'.next #=> '../' '1...9'.next #=> '2...0'
[23:24:24] RickHull: '...9'.next #=> '...10' # whoa
[23:25:03] RickHull: I can't say I'm a big fan of this
[23:28:14] RickHull: "if there is no alphanumeric to the left, then an alphnumeric is inserted to the left"
[23:28:43] RickHull: nope: 'a..9'.next #=> 'a..10'
[23:30:05] RickHull: 'a..z'.next #=> 'b..a' '1..z'.next #=> '1..aa'
[23:30:44] RickHull: so in the case of carry, digits only play with digits and alphas with alphas
[23:31:22] RickHull: and dots are not significant other than being non-alphanumeric
[23:33:47] Technodrome: has joined #ruby-offtopic
[23:40:22] Exhiled: has joined #ruby-offtopic
[23:50:55] Exhiled: has joined #ruby-offtopic
[23:59:04] Exhiled: has joined #ruby-offtopic