« Back to channel list

#ruby - 30 June 2019

« Back 1 day Forward 1 day »
[00:02:01] doodlebug: has joined #ruby
[00:06:38] orbyt_: has joined #ruby
[00:10:33] doodlebug: has joined #ruby
[00:16:32] doodlebug: has joined #ruby
[00:40:32] doodlebug: has joined #ruby
[00:46:34] doodlebug: has joined #ruby
[00:48:54] bambanx: has joined #ruby
[00:52:33] doodlebug: has joined #ruby
[00:58:34] doodlebug: has joined #ruby
[00:58:44] bambanxx: has joined #ruby
[01:04:15] orbyt_: has joined #ruby
[01:04:34] doodlebug: has joined #ruby
[01:07:53] dviola: has joined #ruby
[01:10:34] doodlebug: has joined #ruby
[01:11:51] StarLord__: has joined #ruby
[01:16:34] doodlebug: has joined #ruby
[01:21:47] Freshnuts: has joined #ruby
[01:22:34] doodlebug: has joined #ruby
[01:22:43] chalkmonster: has joined #ruby
[01:23:29] Freshnuts: has joined #ruby
[01:25:08] duderonomy: has joined #ruby
[01:28:37] doodlebug: has joined #ruby
[01:34:37] doodlebug: has joined #ruby
[01:40:38] doodlebug: has joined #ruby
[01:46:39] doodlebug: has joined #ruby
[01:48:35] codefriar: has joined #ruby
[01:51:44] codefriar: has joined #ruby
[01:52:40] doodlebug: has joined #ruby
[01:58:40] doodlebug: has joined #ruby
[02:09:15] fphilipe_: has joined #ruby
[02:47:20] sauvin: has joined #ruby
[03:10:36] braincrash: has joined #ruby
[03:14:04] fphilipe_: has joined #ruby
[03:38:27] chalkmonster: has joined #ruby
[03:42:39] Technodrome: has joined #ruby
[03:48:11] _whitelogger: has joined #ruby
[04:26:43] dedRabbit: has joined #ruby
[04:43:15] yokel: has joined #ruby
[05:00:55] yokel: has joined #ruby
[05:07:00] Emmanuel_Chanel: has joined #ruby
[05:36:08] dellavg_: has joined #ruby
[05:40:42] chalkmon1: has joined #ruby
[05:43:39] chalkmonster: has joined #ruby
[05:44:32] fphilipe_: has joined #ruby
[05:46:29] kyrylo: has joined #ruby
[06:02:15] zululee_: has joined #ruby
[06:08:48] rippa: has joined #ruby
[06:18:22] m_antis: has joined #ruby
[06:26:14] tdy1: has joined #ruby
[06:49:21] fphilipe_: has joined #ruby
[07:01:41] deathwishdave: has joined #ruby
[07:01:47] Ropeney: has joined #ruby
[07:09:09] sandstrom: has joined #ruby
[07:15:10] _whitelogger: has joined #ruby
[07:24:11] _whitelogger: has joined #ruby
[07:54:09] conta: has joined #ruby
[08:01:48] lord4163: has joined #ruby
[08:08:12] deathwishdave: has joined #ruby
[08:11:50] fphilipe_: has joined #ruby
[08:14:12] queip: has joined #ruby
[08:28:47] lord4163: has joined #ruby
[08:44:18] fphilipe_: has joined #ruby
[08:48:10] _whitelogger: has joined #ruby
[09:05:58] schne1der: has joined #ruby
[09:08:48] yokel: has joined #ruby
[09:17:52] sandstrom: has joined #ruby
[09:33:21] sandstrom: has joined #ruby
[09:39:31] xco: has joined #ruby
[09:41:53] fphilipe_: has joined #ruby
[09:51:58] sandstrom: has joined #ruby
[09:52:18] DTZUZO: has joined #ruby
[09:54:42] doodlebug: has joined #ruby
[09:58:54] fphilipe_: has joined #ruby
[10:00:42] doodlebug: has joined #ruby
[10:06:43] doodlebug: has joined #ruby
[10:12:44] doodlebug: has joined #ruby
[10:20:27] xco: has joined #ruby
[10:29:52] sandstrom: has joined #ruby
[10:30:31] fphilipe_: has joined #ruby
[10:36:49] doodlebug: has joined #ruby
[10:47:37] doodlebug: has joined #ruby
[10:48:07] deathwishdave: has joined #ruby
[10:51:38] nima_m: has joined #ruby
[10:53:09] vjacob: has joined #ruby
[10:53:36] doodlebug: has joined #ruby
[10:56:20] Swyper: has joined #ruby
[10:59:37] doodlebug: has joined #ruby
[11:11:12] conta: has joined #ruby
[11:15:06] bga57: has joined #ruby
[11:15:50] sandstrom: has joined #ruby
[11:17:46] mikecmpbll: has joined #ruby
[11:18:37] Fernando-Basso: has joined #ruby
[11:23:42] doodlebug: has joined #ruby
[11:31:21] doodlebug: has joined #ruby
[11:37:20] doodlebug: has joined #ruby
[11:42:44] fphilipe_: has joined #ruby
[11:45:19] doodlebug: has joined #ruby
[11:46:52] staticx: has joined #ruby
[11:51:19] doodlebug: has joined #ruby
[11:57:20] doodlebug: has joined #ruby
[12:00:26] yokel: has joined #ruby
[12:15:10] doodlebug: has joined #ruby
[12:15:35] doodlebug: has joined #ruby
[12:16:07] doodlebug: has joined #ruby
[12:33:02] schne1der: has joined #ruby
[12:33:10] gix: has joined #ruby
[12:35:37] kent\n: has joined #ruby
[12:39:59] haxx0r: has joined #ruby
[12:40:38] xco: has joined #ruby
[12:43:27] Cthulu201: has joined #ruby
[12:47:51] sandstrom: has joined #ruby
[13:04:13] DTZUZO: has joined #ruby
[13:18:14] kyrylo: has joined #ruby
[13:18:29] kent\n: has joined #ruby
[13:29:32] queip: has joined #ruby
[13:32:53] mikecmpb_: has joined #ruby
[13:33:30] Inline: has joined #ruby
[13:39:37] sandstrom: has joined #ruby
[13:41:16] deepreds1: has joined #ruby
[13:46:11] chalkmonster: has joined #ruby
[13:51:30] chalkmonster: make IRC great again
[13:53:52] sandstrom: has joined #ruby
[13:59:57] doodlebug: has joined #ruby
[14:05:59] doodlebug: has joined #ruby
[14:09:49] lord4163: has joined #ruby
[14:11:59] doodlebug: has joined #ruby
[14:13:02] havenwood: ?offtopic chalkmonster
[14:13:02] ruby[bot]: chalkmonster: this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related problems. Thanks!
[14:13:40] fphilipe_: has joined #ruby
[14:16:34] comet23: has joined #ruby
[14:17:59] doodlebug: has joined #ruby
[14:23:59] doodlebug: has joined #ruby
[14:27:09] deathwishdave: has joined #ruby
[14:27:20] masticass: has joined #ruby
[14:29:59] doodlebug: has joined #ruby
[14:31:06] nowhereman: has joined #ruby
[14:33:22] rwb: has joined #ruby
[14:35:59] doodlebug: has joined #ruby
[14:41:13] kyrylo: has joined #ruby
[14:41:49] sandstrom: has joined #ruby
[14:42:00] doodlebug: has joined #ruby
[14:44:56] cd: has joined #ruby
[14:45:14] mniip: has joined #ruby
[14:50:42] xco: has joined #ruby
[14:50:55] yokel: has joined #ruby
[14:57:22] AJA4350: has joined #ruby
[15:00:26] yokel: has joined #ruby
[15:06:02] doodlebug: has joined #ruby
[15:07:48] Swyper: has joined #ruby
[15:12:02] doodlebug: has joined #ruby
[15:12:28] doodlebug: has joined #ruby
[15:12:48] comet23: how can we check what the return type is for the class method?
[15:12:57] doodlebug: has joined #ruby
[15:13:06] comet23: like 1.class => Fixnum
[15:13:21] comet23: how do we know if Fixnum is a string or the entire class?
[15:13:25] doodlebug: has joined #ruby
[15:13:56] doodlebug: has joined #ruby
[15:14:22] doodlebug: has joined #ruby
[15:14:52] doodlebug: has joined #ruby
[15:16:18] fphilipe_: has joined #ruby
[15:19:25] ytti: comet23, i don't understand 1.class.class == Class
[15:22:47] ruby[bot]: -b wintgeensteyn!*@*$#ruby-banned
[15:23:14] comet23: i mean is Fixnum the entire object
[15:23:18] comet23: or is Fixnum a string?
[15:25:47] ruby[bot]: -bbbb $a:flugzeug[m]$#ruby-banned NoNoNo!*@*$#ruby-banned RubyForGays!*@*$#ruby-banned RubySucks!*@*$#ruby-banned
[15:25:49] ruby[bot]: -b RubyIsSh1t!*@*$#ruby-banned
[15:27:23] erts: has joined #ruby
[15:29:46] havenwood: comet23: These days: 1.class #=> Integer
[15:30:13] havenwood: &>> 1.class.ancestors
[15:30:17] rubydoc: # => [Integer, Numeric, Comparable, Object, Kernel, BasicObject] (https://carc.in/#/r/75uu)
[15:30:18] comet23: i mean Integer
[15:30:36] havenwood: comet23: It's not a String. Say more about what you're wanting to know?
[15:30:49] comet23: is Integer the entire class or is it a string output
[15:31:10] comet23: is it "Integer" or Integer?
[15:31:19] havenwood: comet23: The latter.
[15:31:26] comet23: thank you :)
[15:33:05] comet23: is there any way to convert the name of the class into a string?
[15:33:19] comet23: i mean by using default methods
[15:33:26] comet23: i tried .to_s and it didn't work
[15:35:02] comet23: https://repl.it/repls/FrankBoilingOutliers
[15:35:47] havenwood: &>> 1.class.name # comet23
[15:35:47] rubydoc: # => "Integer" (https://carc.in/#/r/75uv)
[15:35:56] comet23: thank you :)
[15:36:00] havenwood: &>> 1.class.to_s # comet23
[15:36:00] rubydoc: # => "Integer" (https://carc.in/#/r/75uw)
[15:36:22] comet23: for some reason it's not working
[15:36:38] havenwood: comet23: What's not?
[15:36:42] comet23: https://repl.it/repls/FrankBoilingOutliers
[15:37:02] comet23: i'm trying to have that function check for incorrect input as well
[15:38:30] havenwood: comet23: It seems you inverted your logic with your `return "ERROR"` line.
[15:39:14] havenwood: comet23: It's always going to not be one or the other.
[15:39:42] havenwood: comet23: In all cases, it's either not 'Float' OR not 'Integer'.
[15:41:45] comet23: i thought || meant one or the other
[15:41:57] comet23: i thought && meant both have to be true
[15:42:47] havenwood: comet23: I'd recommend converting to what you need rather than manually checking class names.
[15:43:10] havenwood: comet23: BigDecimal might be a flexible thing to use.
[15:43:39] havenwood: comet23: Your line 10 is bug prone, since `total` might be an Integer, meaning #/ would round.
[15:44:30] havenwood: comet23: #fdiv is a handy method when you really want to divide to a Float.
[15:44:32] rubydoc: # => 3 (https://carc.in/#/r/75v8)
[15:44:40] havenwood: &>> 10.fdiv(3)
[15:44:42] rubydoc: # => 3.3333333333333335 (https://carc.in/#/r/75v9)
[15:44:46] comet23: so many lessons here :D
[15:46:09] havenwood: comet23: It's nice to use :ok and :error for Erlang-style return values. So `:error` instead of `"ERROR"`, though these days it matters less with frozen string literals available.
[15:46:30] havenwood: comet23: Typically, you'd `raise` in this case, after say a `to_int` conversion attempt.
[15:46:39] havenwood: comet23: You see a lot of examples of that in the stdlib.
[15:46:59] havenwood: (Not #to_int here, since your logic deals with fractions.)
[15:47:52] havenwood: &>> require 'bigdecimal'; require 'bigdecimal/util'; 10.to_d / 3
[15:47:53] rubydoc: # => 0.3333333333333333333e1 (https://carc.in/#/r/75vn)
[15:48:04] havenwood: &>> require 'bigdecimal'; require 'bigdecimal/util'; '10'.to_d / 3
[15:48:04] rubydoc: # => 0.3333333333333333333e1 (https://carc.in/#/r/75vp)
[15:50:39] havenwood: comet23: Floats tend to be a mess to use. They're not just decimal numbers. They're fast, but there're enough gotchas they're problematic in many cases.
[15:51:00] havenwood: comet23: BigDecimal or Rational are often better choices.
[15:51:34] comet23: what are floats if they're not just decimal numbers?
[15:51:46] havenwood: &>> 10r / 3
[15:51:46] rubydoc: # => (10/3) (https://carc.in/#/r/75vv)
[15:53:07] havenwood: comet23: "Float objects represent inexact real numbers using the native architecture's double-precision floating point representation."
[15:53:18] havenwood: comet23: "Floating point has a different arithmetic and is an inexact number. So you should know its esoteric system."
[15:53:26] rubydoc: https://ruby-doc.org/core-2.6/Float.html
[15:53:52] comet23: and bigdecimal is not a float?
[15:54:11] comet23: i mean a bigger float
[15:54:32] havenwood: comet23: From the docs:
[15:54:34] havenwood: "Decimal arithmetic is also useful for general calculation, because it provides the correct answers people expect–whereas normal binary floating point arithmetic often introduces subtle errors because of the conversion between base 10 and base 2."
[15:55:30] comet23: oh, that's very interesting... here i thought a float is the jargon for decimal numbers
[15:55:39] havenwood: comet23: BigDecimal will be the behavior you expect, where Float will seem wrong and bizarre if you're not familiar with binary floats.
[15:55:57] comet23: i'm going to try to learn from the docs and not from online videos
[15:56:53] comet23: docs are a bit hard to read for me due to their terse wording
[15:57:13] havenwood: &ri BigDecimal
[15:57:13] rubydoc: https://ruby-doc.org/stdlib-2.6/libdoc/bigdecimal/rdoc/BigDecimal.html
[15:57:17] havenwood: &ri Rational
[15:57:17] rubydoc: https://ruby-doc.org/core-2.6/Rational.html
[15:58:30] havenwood: comet23: I don't think new folk to programming should even be taught Floats. They're not particularly useful for most things.
[15:58:31] havenwood: And they're indeed esoteric.
[15:59:43] comet23: i don't think it's being taught floats that is the problem
[15:59:48] reber: has joined #ruby
[16:00:52] havenwood: ¯\_(ツ)_/¯
[16:01:06] comet23: i think it's being taught things without explaining their respective use cases
[16:01:40] comet23: here's a float, floats are decimal numbers this is how you use them now go have fun :)
[16:01:49] havenwood: comet23: I'm not against learning about Floats at all. :) I just think they get introduced early on to new folk, when experienced folk aren't using them. We shouldn't introduce esoteric parts like Float and Matrix right up front.
[16:02:29] havenwood: No harm in using Float or Matrix or whatever else, but just because Floats look like decimal numbers isn't a good excuse to teach them to newcomers imho.
[16:02:43] comet23: they're also presented as such
[16:02:48] havenwood: aren't using them often*
[16:02:52] havenwood: comet23: Ah, good. :)
[16:18:46] sandstrom: has joined #ruby
[16:35:01] conta: has joined #ruby
[16:36:27] orbyt_: has joined #ruby
[16:43:56] GodFather: has joined #ruby
[17:38:12] doodlebug: has joined #ruby
[17:38:34] doodlebug: has joined #ruby
[17:46:34] fphilipe_: has joined #ruby
[17:51:24] deathwishdave: has joined #ruby
[18:00:27] yokel: has joined #ruby
[18:05:22] AJA4351: has joined #ruby
[18:06:33] jmcgnh_: has joined #ruby
[18:08:05] henninb: has joined #ruby
[18:12:41] moei: has joined #ruby
[18:15:17] henninb: has left #ruby: ()
[18:24:02] orbyt_: has joined #ruby
[18:28:44] queip: has joined #ruby
[18:34:41] henninb: has joined #ruby
[18:36:13] amrx: has joined #ruby
[18:36:26] leitz: has joined #ruby
[18:38:19] Exuma: has joined #ruby
[18:38:38] henninb: has joined #ruby
[18:42:20] henninb: has joined #ruby
[18:47:45] fphilipe_: has joined #ruby
[18:50:17] camilasan: has joined #ruby
[19:00:20] henninb: has joined #ruby
[19:02:02] deathwishdave: has joined #ruby
[19:14:35] queip: has joined #ruby
[19:19:31] paulcarroty: has joined #ruby
[19:23:35] deathwishdave: has joined #ruby
[19:27:48] Tempesta: has joined #ruby
[19:29:32] fphilipe_: has joined #ruby
[19:40:08] deepreds1: has joined #ruby
[19:49:55] armyriad: has joined #ruby
[19:50:50] fphilipe_: has joined #ruby
[19:56:22] lucasb: has joined #ruby
[19:57:32] reber: has joined #ruby
[19:57:54] fphilipe_: has joined #ruby
[20:14:51] s3nd1v0g1us: has joined #ruby
[20:14:55] kyrylo: has joined #ruby
[20:17:42] crankharder: has joined #ruby
[20:22:55] crankharder: has joined #ruby
[20:23:40] BH23: has joined #ruby
[20:31:44] crankhar1er: has joined #ruby
[20:34:22] Exuma: has joined #ruby
[20:35:35] fphilipe_: has joined #ruby
[20:49:11] matthewd: has joined #ruby
[20:52:38] crankharder: has joined #ruby
[20:53:21] xco: has joined #ruby
[20:55:18] Technodrome: has joined #ruby
[20:56:42] ur5us: has joined #ruby
[20:57:02] Freshnuts: has joined #ruby
[21:00:27] yokel: has joined #ruby
[21:00:32] crankhar1er: has joined #ruby
[21:00:37] armyriad: has joined #ruby
[21:12:24] SCHAPiE: has joined #ruby
[21:16:38] leitz: Yay me! Just finished studying "Head First Ruby". Except for the appendix, which I'll get to shortly.
[21:19:19] queip: has joined #ruby
[21:19:19] h2t4vc7s9: has joined #ruby
[21:37:40] staticx: has joined #ruby
[21:40:42] bambanx: has joined #ruby
[22:17:34] fphilipe: has joined #ruby
[22:26:41] havenwood: leitz: nice!
[22:27:22] Technodrome: has joined #ruby
[22:29:31] chalkmonster: has joined #ruby
[22:32:36] leitz: Yeah, but pretty brain dead. I've spent most of my free time this week on it.
[22:34:39] leitz: Also spent some time on the question you asked, havenwood, about what projects I'm working on. Wrote them up in short form, and some of the questions and challenges.
[22:41:44] bambanxx: has joined #ruby
[22:48:04] fphilipe: has joined #ruby
[22:53:35] chalkmonster: has joined #ruby
[23:09:30] Emmanuel_Chanel: has joined #ruby
[23:15:51] orbyt_: has joined #ruby
[23:17:35] henninb: has joined #ruby
[23:18:35] queip: has joined #ruby
[23:37:27] StarLord__: has joined #ruby
[23:45:10] _whitelogger: has joined #ruby
[23:47:31] bambanxx: has joined #ruby