#ruby-offtopic - 30 November 2017
« Back 1 day Forward 1 day »
[12:42:06] apeiros: is it whataboutism if when reading https://12factor.net/port-binding I ask "what about sockets?"?
[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
[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: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
[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: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: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: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:22:30] dminuoso: RickHull: Well there's certain tricks actually using the flexible precedence system
[21:25:15] dminuoso: Which declares this operator to have lowest precedence possible and be right associative.
[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: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: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:52] RickHull: that's a good example for showing how to reduce big O complexity without changing the data structure
[21:41:12] dminuoso: RickHull: Well there's a deeply mathematical reason to use a singly linked list.
[21:42:28] dminuoso: RickHull: The point is, a list [1,2,3,4] is actually desugared into 1:(2:(3:(4:)))
[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
[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: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:28:14] RickHull: "if there is no alphanumeric to the left, then an alphnumeric is inserted to the left"