<TomyWork>
but nokogiri seems to discard all the HTML entities
<TomyWork>
and in HTML mode, it doesn't like the namespaces
<TomyWork>
so what do I do? :)
<roadie>
I want to install git-lfs via homebrew. this requires homebrew ruby which will install to /usr/local I think. I have ruby via rvm - is this going to cause problems having the 'additional' ruby from homebrew?
sergioro has quit [Quit: leaving]
<jhass>
roadie: it shouldn't
<roadie>
jhass: thank you - installing
iNs has quit [Remote host closed the connection]
iNs has joined #ruby
<TomyWork>
i put this in front of it, which seems to at least make it parse the entities: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
markoong has joined #ruby
kevinburke has quit [Quit: Connection closed for inactivity]
<TomyWork>
so does anyone know how to tell nokogiri to replace all the HTML entities in an XML document? :)
<TomyWork>
well i gave it an xhtml doctype, so it's valid :)
<jhass>
maybe a preprocessing step that parses out any entities, decodes them, for example using the gem I linked earlier, and then reencodes them to the cannonical &#xx; form can work
<TomyWork>
at least valid as far nokogiri cares
<jhass>
even if you Nokogiri::XML(foo) {|o| o.strict } ?
alexherbo26 has joined #ruby
<TomyWork>
that's in my gist
alexherbo2 has quit [Ping timeout: 255 seconds]
alexherbo26 is now known as alexherbo2
<jhass>
ah sorry, overlooked that one somehow
<jhass>
yeah, seems legit
burningserenity has joined #ruby
<TomyWork>
.accept is next to useless btw :)
<TomyWork>
child.accept(self) is equivalent to self.visit(child)
<jhass>
well, visitor pattern, eh?
<TomyWork>
but it looks nice and visitorpatterny
<TomyWork>
it looks like i know wtf i'm doing
stryek has joined #ruby
drincruz has joined #ruby
postmodern_ has quit [Quit: Leaving]
BartPB has quit [Ping timeout: 256 seconds]
<TomyWork>
I'm trying to find an xpath expression that will match both <br/> and text nodes
<TomyWork>
so i can build text from them
<TomyWork>
seems to be hard, because .//* already discards all text nodes
<jhass>
take care libxml2/nokogiri is xpath 1.1 still, no xpath 2.0 sugar
cyberarm has joined #ruby
<TomyWork>
yeah but this page didn't even list the |
yokel has quit [Ping timeout: 258 seconds]
kaleido has quit [Quit: ZNC 1.7.4+deb7 - https://znc.in]
kaleido has joined #ruby
yokel has joined #ruby
LnxBil has joined #ruby
<LnxBil>
Hi everybody! Is there a predefined regexp I can use to validate a hostname? For an IP there is Resolv::IPv4::Regex, what about a hostname?
kinduff has quit [Quit: gg]
<jhass>
isn't it just [a-z]([a-z0-9-]\.?)* ?
<leitz>
LnxBil, hostnames can be a variety of things. If you mean "a string that would be a valid hostname", that's one thing. If you mean "the name of a host that's in the domain name system", that's another.
<LnxBil>
leitz: Only the RFC definition, I don't want to resolve it.
<LnxBil>
leitz: I found a bunch of different implementation, but I really like to build upon work that is already present in ruby somewhere and do not want to define it myself in my code.
<LnxBil>
leitz: One way to do it is via URI.parse("http://#{hostname}/")...
<jhass>
honestly, most of the time you don't need to validate it, just try to use it and let it fail there if invalid
kinduff has joined #ruby
<LnxBil>
jhass: Yes, that was my intention until now, but the input is used "further down the pipeline" and it crashed there.
<jhass>
so it's user input? probably worth to try to punycode it and then check with something like above
<jhass>
but valid doesn't mean existing, so it doesn't seem like you can prevent all possible failures here
alexherbo24 has joined #ruby
alexherbo2 has quit [Ping timeout: 258 seconds]
alexherbo24 is now known as alexherbo2
<LnxBil>
Yes, existing is another problem, but the input is not resolveable on the system it is inputted. Simple validation would be sufficient.
<LnxBil>
I just find it odd, that there is no "official" Regexpr (in whatever RFC-format) already presend in Ruby like Resolv::IPv4::Regex.
<LnxBil>
or at least I could not find it. If there is none, that is also an answer I can live with
<jhass>
honestly that's more of an implementation detail
<jhass>
I'd think about how to turn the "crash" into an error case that can be propagated back up to the user
lucasb has joined #ruby
<leitz>
LnxBil, I see what you mean. Making an RFC compliant parser could be a project.
<leitz>
To have a '-r' option to actually test by DNS resolution.
<LnxBil>
jhass: It is deployed in a docker-based cloud on the customer side and the invalid entry turns up in a docker-compose.yml ... so no back channel.
<LnxBil>
But thanks for all suggestions, I'm going to use the URI.parse stuff.
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
markopasha has quit [Ping timeout: 258 seconds]
TCZ has joined #ruby
markopasha has joined #ruby
cschneid has joined #ruby
TzilTzal has joined #ruby
cschneid_ has quit [Ping timeout: 268 seconds]
LnxBil has quit [Quit: leaving]
<TzilTzal>
Hi
<TzilTzal>
If I need to write a server/daemon that just accepts client requests without any views (html, etc..) - should I use RoR or Sinatra? or is there a simpler/better way of doing this?
ElFerna has quit [Read error: Connection reset by peer]
ElFerna has joined #ruby
mre- has joined #ruby
<jhass>
so it has to be HTTP requests?
<jhass>
how many different kinds of requests/endpoints?
<TzilTzal>
Doesn't have to be HTTP.. but it's quite common these days, I'd say...
<TzilTzal>
hmmm... not too many. Can't say exactly, but fairly small number.
<jhass>
if it's one or two I'd consider just plain rack, otherwise sinatra seems fine
<TzilTzal>
Cool. Thanks!
<TzilTzal>
Oh, but is it possible to not have views in Sinatra or RoR?
<jhass>
of course
<jhass>
sinatra just returns whatever the return value of the route block is
<TzilTzal>
What about things like authentication and client management? Easy to do with Rack?
<jhass>
rails just returns whatever the return value of the action is, essentially
<jhass>
depends on what kind of authentication
<TzilTzal>
what do you mean?
<jhass>
just basic auth? cookie auth? access token?, ...
<TzilTzal>
all of the above? )
<jhass>
seems like you just don't know :P How would a nice cookie based auth flow look like without a sign in view?
<jhass>
anyways, all ruby HTTP server frameworks use rack under the hood
<jhass>
so there's some rack based authentication frameworks, like for example warden
<jhass>
whether that's easy is kinda subjective, whether it fits you need I don't know, everything seems too vague to guess
<adam12>
TzilTzal: You probably just want to use Rails. There's also rails-api which is Sinatra like in terms of liteness.
<adam12>
TzilTzal: Sinatra is great for this (as is Roda, hanami-api) but you need to assemble a lot of pieces yourself. If you're not familiar with how to do that it can be a huge time sink.
TCZ has quit [Quit: Leaving]
fluxAeon has quit [Ping timeout: 256 seconds]
burningserenity has quit [Ping timeout: 260 seconds]
pupsikov has joined #ruby
fluxAeon has joined #ruby
Tungki has joined #ruby
lxsameer has quit [Ping timeout: 260 seconds]
ElFerna has quit [Ping timeout: 265 seconds]
TzilTzal has quit [Quit: Leaving.]
burningserenity has joined #ruby
TCZ has joined #ruby
ElFerna has joined #ruby
ElFerna has quit [Client Quit]
ldepandis has quit [Ping timeout: 260 seconds]
Tungki has quit [Ping timeout: 252 seconds]
fluxAeon has quit [Ping timeout: 265 seconds]
chalkmonster has quit [Quit: WeeChat 2.7.1]
fluxAeon has joined #ruby
mre- has quit [Ping timeout: 258 seconds]
ellcs has quit [Ping timeout: 256 seconds]
lightstalker has quit [Remote host closed the connection]
lxsameer has joined #ruby
markopasha has quit [Remote host closed the connection]
ChmEarl has joined #ruby
thecoffemaker has quit [Ping timeout: 256 seconds]
mre- has joined #ruby
paraxial2 has joined #ruby
mre- has quit [Ping timeout: 260 seconds]
paraxial has quit [Ping timeout: 255 seconds]
paraxial2 is now known as paraxial
d3bug has joined #ruby
yelloB has joined #ruby
yelloB has quit [Remote host closed the connection]
conta1 has joined #ruby
cschneid has quit [Ping timeout: 256 seconds]
cschneid has joined #ruby
SanguineAnomaly has joined #ruby
GodFather has joined #ruby
pupsikov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
burningserenity has quit [Ping timeout: 258 seconds]
ttoocs has quit [Ping timeout: 256 seconds]
fluxAeon has quit [Ping timeout: 260 seconds]
fluxAeon has joined #ruby
orbyt_ has joined #ruby
sdu has quit [Quit: leaving]
burningserenity has joined #ruby
kristian_on_linu has joined #ruby
fluxAeon has quit [Ping timeout: 265 seconds]
TCZ has quit [Quit: Leaving]
TCZ has joined #ruby
markopasha has joined #ruby
markopasha has quit [Remote host closed the connection]
markopasha has joined #ruby
cthulchu has joined #ruby
fercell has quit [Quit: WeeChat 2.7]
ellcs has joined #ruby
schne1der has quit [Ping timeout: 265 seconds]
Ai9zO5AP has joined #ruby
TCZ has quit [Quit: Leaving]
ellcs has quit [Ping timeout: 240 seconds]
cd has joined #ruby
mre- has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
<plujon>
Greetings. I am seeking a succinct description of API changes in various ruby versions. Is there a page dedicated to this? I've found https://www.ruby-lang.org/en/news/ , but it takes a fair amount of scrolling and clicking to navigate.
<plujon>
As an example, I'm about to document that MyClass.alias_method is private in some versions of ruby (such as 2.3), but that it isn't private in newer versions (such as 2.5.1).
<plujon>
I'm curious when it became private, and if there's a document where I can discover such things. I develop using Ruby 2.5 and deploy to Ruby 2.3 machines, and that's bitten me a couple times.
<plujon>
Wow, this site is *exactly* what I wanted.
<adam12>
plujon: Yeah. zverok did a great job.
<adam12>
plujon: Probably deserving of a beer if you ever meet them.
<adam12>
Between that and rubyapi.org, docs are getting much better.
<adam12>
(and the stabilities that lsegal have been doing to rubydoc.info)
cliluw has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
sauvin has quit [Read error: Connection reset by peer]
<plujon>
There's a patreon link. As of a few minutes ago, he had 0.
<leitz>
Well, I converted my shell code style crewgen to something that might be mistaken for a Builder design pattern. Assuming you squint a bit, and are half drunk.
<leitz>
Still working on the whole design pattern concept. I get the concept, but implementation is a different beast.
d3bug has quit [Quit: Connection closed for inactivity]
<havenwood>
leitz: Is it better before or after the refactor?
<leitz>
havenwood, well....
gix has joined #ruby
<leitz>
havenwood, it passes the tests, keeps one of the object from knowing stuff it shouldn't, creates one less class, where it shouldn't, and is mildly extendable.
TomyWork has quit [Remote host closed the connection]
<havenwood>
leitz: @ship.fetch(:weapons, 0)
<havenwood>
leitz: If there's a `:weapons` key, return the value, otherwise `0`.
<leitz>
havenwood, there's still a lot to do; many of the recommendations you made are on the agenda. However, I fried both brain cells this morning, just getting the basic functionality.
<leitz>
havenwood, fetch works once I remove the default assignment of nil.
bsdbandit-01 has joined #ruby
<havenwood>
leitz: What should a default be? The reason for #fetch here is that it'd blow up with a `nil`, but with a worse error.
* leitz
goes to ponder fdiv, ceil, and clamp
<havenwood>
leitz: #fdiv is division on an Integer when you want a Float result, so you don't have to 35.0.
<havenwood>
leitz: You were already using #ceil.
markopasha has joined #ruby
<havenwood>
leitz: #clamp is saying ensure it's between these, being 1 as a minimum and no maximum.
<havenwood>
leitz: A nice readability refactor to this code would be switching to 1.9+ style Hash symbol keys. So `role: 'Medic'` instead of `:role => 'Medic'`.
<havenwood>
(RuboCop should make short work of that with: `rubocop -a`.
<havenwood>
)
<leitz>
havenwood, I never really 'like' something until I can explain it. Just because I type it, doesn't mean I like it. :)
<leitz>
havenwood, and that's why I dislike rubocop's auto-change everything. Worse than gofmt...
<havenwood>
leitz: But it'd be standard code that others can read and you'll be learning a style that is lovely and readable.
<leitz>
havenwood, which is not to say the idea of style guides is bad, but I prefer to know why I'm doing something.
<havenwood>
leitz: If you wonder why on any of the RuboCop rules, happy to discuss at length. They're worth following though until you know why not.
<havenwood>
leitz: The reason to extract the Arrays is that these methods currently create a new Array every time they're called.
<havenwood>
leitz: This puts pressure on the garbage collector (GC), which has to remove them from memory after they're dereferenced after each method call.
<havenwood>
leitz: So do like: SIZES = ["very small", "small", "small", "medium", "large"].freeze
<havenwood>
leitz: Then in the method: SIZES.sample
<havenwood>
leitz: Then you only have one Array ever, instead of a new Array every time.
<havenwood>
leitz: Does that make sense?
<leitz>
havenwood, yes, it makes sense. One (of many) thing I'm working to understand is "class things" outside of methods and variables. Like, when to use a class variable, or a constant.
<leitz>
havenwood, this is one of the code bits I want to use in the 90DW project. So I need to know it well enough to explain well. :)
<leitz>
havenwood, in churn.rb, baz.equal? is because it's doing the === comparison, and it's the same object? Where foo.equal?(foo) actually calls foo twice, and created different objects?
<havenwood>
leitz: No, it's not doing #=== comparison. They'd all be threequals equal.
<havenwood>
leitz: Yes, it's checking if they're the same object. You could alternatively look at #object_id twice.
<havenwood>
leitz: #==, #===, #eql?, and #equal? are all different things.
<leitz>
havenwood, ah, gotcha. I knew there were some differences, but forgot they were all different.
<havenwood>
leitz: You typically use #== and #equal? directly, and define #eql? and #=== on classes to enable functionality for Hashes, case statement, etc.
<havenwood>
leitz: #== is by far the most commonly used.
<havenwood>
leitz: #equal? if for checking if they're the same #object_id.
<havenwood>
leitz: "Unlike #==, the equal? method should never be overridden by subclasses as it is used to determine object identity (that is, a.equal?(b) if and only if a is the same object as b)"
<havenwood>
leitz: "The eql? method returns true if obj and other refer to the same hash key. This is used by Hash to test members for equality."
<havenwood>
leitz: "Case Equality – For class Object, [#=== is] effectively the same as calling #==, but typically overridden by descendants to provide meaningful semantics in case statements."
<havenwood>
leitz: So don't use #eql? and #=== directly. Only define them for their purpose. Generally use #==, unless you really want to know, "Is this the exact same object?"
<havenwood>
leitz: Let us know if you want more code review! I'd recommend studying Rubocop recommendations, and either adopt them or change the rules sparingly.
FastJack has quit [Ping timeout: 258 seconds]
<leitz>
havenwood, what takes you 5 minutes to explain takes me 3-4 hours to digest. I can only comprehend so much havenwood per coding session. :)
<havenwood>
leitz: Just let me know if you want more suggestions! :)
<leitz>
havenwood, looking at the reduce docs now.
<havenwood>
leitz: That's the most complicated of my suggestions today.
<havenwood>
leitz: That's ^ like a #join but with #reduce.
FastJack has quit [Ping timeout: 258 seconds]
burningserenity has quit [Ping timeout: 240 seconds]
<havenwood>
leitz: The argument to #reduce (an empty string in this case) is the first block argument and is replaced by the result of the block on each iteration.
<leitz>
havenwood, sort of like ijnect?
<leitz>
inject
<havenwood>
leitz: #reduce is an alias to #inject.
<havenwood>
leitz: (it's called #reduce in most languages)
<leitz>
havenwood, ahhhhh
<havenwood>
leitz: We say map/reduce these days not collect/inject, which are Smalltalkisms, I believe.
DTZUZU has quit [Ping timeout: 265 seconds]
oz has joined #ruby
<leitz>
havenwood, my Smalltalk books aren't here yet. I was hoping for some good weekend reading. :(
<havenwood>
leitz: Some say that Ruby is the Smalltalk dialect that thrived. ;)
bsdband74 has joined #ruby
DTZUZU has joined #ruby
<leitz>
havenwood, I think of Ruby as "readable Perl". :)
markopasha has quit [Remote host closed the connection]
alexherbo2 has quit [Ping timeout: 268 seconds]
<leitz>
havenwood, I've seen a few references to Smalltalk learning being useful for a growing Rubyist. Hence the book order.
markopasha has joined #ruby
markopasha has quit [Remote host closed the connection]
<havenwood>
I don't know enough Smalltalk to say. I do think Ruby is the most useful language for a growing Rubyist to learn though.
<havenwood>
leitz: Clojure, Elixir, and Rust are a few modern languages I'd recommend a Rubyist look at.
<havenwood>
leitz: And the JRuby and TruffleRuby are Rubies to look at.
<leitz>
havenwood, my personal challenge is writing Ruby code that doesn't look like my shell code. Specifically, to actually use and understand objects. When doing job interviews, I want to show that I've grown from my sysadmin life to a programmer's way of thinking.
<leitz>
havenwood, assuming you programmers think. :) I spent decades fixing things that "worked on my dev computer".
<leitz>
As for other languages, I'm torn between C and Go. The former lets me tie into Ruby more directly, the latter has a lot buzz and a growing job list. I'm old, and getting ahead of the implementation curve means I can stick with it until I croak off.
markopasha has joined #ruby
<havenwood>
leitz: I'd suggest the simplest thing that can possibly work, then refactor when the refactor improves the code's readability.
<leitz>
What's the convention for placing an "alias" stanza? After initialize, and before the defs? At the end?
d3bug has joined #ruby
<havenwood>
leitz: Alongside the methods. Just instead of `def ...` do `alias ...`.
<havenwood>
leitz: Like def, alias is a keyword.
gitter1234 has joined #ruby
mre- has joined #ruby
* leitz
is seriously appreciating those tests, right about now.
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood>
leitz: I start by thinking, "How many instances of state do I have?" If none, a module is perfect. If one, consider a singleton class. If many, a class is usually best.
<havenwood>
leitz: It can sometimes be nice to abstract your option parsing into your gem namespace, then use that clean interface from the executable. For example: https://github.com/pry/pry/blob/master/bin/pry
<havenwood>
leitz: Pry has a much more complicated option parser, but the point is the same.
<havenwood>
leitz: Keep moving behavior inside your gem namespace.
<leitz>
havenwood, yup. I haven't gotten to the option parsing recommendations you made the other day, that's on my agenda.
<havenwood>
Nice. Making gradual, constant improvements and then keeping those learnings as you move from project to project will hone your code instincts.
<havenwood>
Also, you can poach your old work for patterns, once you establish good ones.
<leitz>
havenwood, there was sort of an "a-ha" moment when I realized a Ship should not know about crew requirements, and Crew shouldn't care about what roles were filled. It made the classes much cleaner.
<havenwood>
leitz: :D
<leitz>
havenwood, while I change that line, that's actually one of my wins for the day. I eliminated a method, and sequencing, there. It was pretty nice, from my Apprentice perspective.
<leitz>
havenwood, how to eliminate the leading comma? skills.reduce('') { |string_accumulator, letters| "#{string_accumulator},#{letters[0]}-#{letters[1]}" }
NODE has joined #ruby
kinduff has joined #ruby
<apotheon>
leitz: It turns out this has been a very busy week for me. Sorry about not getting back to you about stuff.
tf2ftw has quit [Remote host closed the connection]
markopasha has joined #ruby
markopasha has quit [Read error: Connection reset by peer]
<leitz>
While busier, visually, I prefer the first. It's a good teaching point; Ruby's ability to computer inside a nested #{} is something that might pleseantly surprise folks.
<adam12>
kaleido: In theory, total is just results.sum?
<kaleido>
yes
<adam12>
kaleido: So if that's the case, you could just do that at the end. Array#sum is newish so depends on your Ruby version.
<adam12>
kaleido: I suggest adding a line the next time you paste code that shows me how to run it. ie. roll(1, 3). I have no idea what numbers to provide.
<leitz>
kaleido, for the record, adam12 is one of the folks to listen to. :)
<adam12>
kaleido: You assign dice_sides and num_rolls from s, r. I'd probably just make those the method names in the method head.
<adam12>
def roll(num_rolls, dice_sides)
<kaleido>
ahh good call
<kaleido>
and thanks
<adam12>
Bonus points, accept them as keyword args so the order don't matter. def roll(num_rolls:, dice_sides:)
<kaleido>
trying to learn to do "something" then learn to do it "right"
<leitz>
kaleido, the best way to learn.
<adam12>
kaleido: Nothing wrong with what you did. Some of these suggestions require deeper Ruby knowledge.
<adam12>
(ie. chaining enumerbale)
<adam12>
Enumerable O_O
<leitz>
That too.
<adam12>
(not Christianbale or Batman)
<leitz>
kaleido, a simple change, drop line 8 and make line 9 results << rand(1..sides)
<leitz>
kaleido, then results.sum
<leitz>
I learned about fdiv today, so you could get the average
gendarme has quit [Remote host closed the connection]
<leitz>
results.sum.fdiv(results.count)
<adam12>
leitz: Hilariously, I dont' recall ever using fdiv. Ever. So that was new to me too.
<adam12>
leitz: But havenwood knows all the good new tricks.
<apotheon>
_phaul: Yeah, that's kind of a standard #times use case right there.
<kaleido>
_phaul: and still .map after? num_rolls.times.map { blahblah }
<kaleido>
?
dviola has joined #ruby
<_phaul>
yeah, you need map to make it work
<leftylink>
well, you're still doing a `map`, so yes, you still need a `.map`
<apotheon>
kaleido: sure
<apotheon>
otherwise you don't get an array as return value
<kaleido>
got it, got it. wasn't thinking that through.
<apotheon>
This makes me want to work on my dicebot again.
<apotheon>
It's old and crusty now, though still very useful.
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<apotheon>
I bet it's full of refactoring opportunities.
<kaleido>
heh, i just wanted some way to learn some basic stuff. maybe someday it won't be so basic :D
gendarme has joined #ruby
<apotheon>
Writing small, useful tools is a great way to learn.
gendarme has quit [Remote host closed the connection]
TCZ has joined #ruby
gendarme has joined #ruby
ur5us has joined #ruby
<leitz>
kaleido, an idea, if you like. I have a project I'm working, on, and am planning to offer to help new Ruby folks learn by forking the project and doing stuff they want.
<leitz>
I'm pretty sure we could even figure out exploding dice, like 7th Sea.
dviola has joined #ruby
dviola has left #ruby ["WeeChat 2.7.1"]
dviola has joined #ruby
dviola has left #ruby ["WeeChat 2.7.1"]
dviola has joined #ruby
dviola has quit [Quit: WeeChat 2.7.1]
<leitz>
For those of you I'm likely to tap for mentoring, here are the notes I wrote from the original project. It goes for 90 days, and mentors play a key role.
<apotheon>
kaleido: I don't know if you actually want those brackets in there.
<leitz>
kaleido, there was a bug in the code I sent earlier. Ruby defaults to integer division, unless at least one of the numbers is a float. This fixes that.
<leitz>
The "fdiv", if I understand havenwood correctly, ensures the result is a float.
<leitz>
And there should be a closing "]" on that line.
<leitz>
It's late, I'm pooped.
<havenwood>
leitz: For your printf line, check out Rubocop's suggestion for named parameters.
<kaleido>
thanks both of you
<havenwood>
leitz: 3 / 2 #=> 1
<kaleido>
apotheon: those brackets were annoying the hell out of me :)
<havenwood>
leitz: 3.fdiv(2) #=> 1.4
<leitz>
havenwood, most of the time, dividing 3 by 2 gives you 1.5. :)
<havenwood>
1.5, haha
<leitz>
Computer rounding error...
<leftylink>
no, it was just for large values of 2
TorpedoSkyline has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<leitz>
And skinny values of 3
<havenwood>
leitz: But, the Integer#/ method returns a rounded Integer, while Integer#fdiv returns a Float.
<apotheon>
I sometimes feel like I want to embark on an ambitious quest to write fractional math tools for every language I use without dealing with IEEE 754 floating point numbers.
<havenwood>
I don't much care for Floats.
<havenwood>
I don't tend to use them at all.
<havenwood>
Or, at least as little as possible.
<apotheon>
Yeah, I try to stay away from built in floats, primarily thanks to IEEE 754.
<leitz>
I've eaten a lot of fast food in my life; I float.
<apotheon>
only misplace their tempers
troulouliou_div2 has quit [Quit: Leaving]
cschneid_ has quit [Ping timeout: 256 seconds]
dionysus69 has quit [Quit: dionysus69]
cschneid has joined #ruby
noboruma has quit [Remote host closed the connection]
al3xandr0s has joined #ruby
gendarme has quit [Quit: gendarme]
caterfxo has quit [Quit: leaving]
_phaul is now known as phaul
bsdbandit-01 has quit [Ping timeout: 268 seconds]
oz has quit [Quit: EOF]
NODE has quit [Quit: changing servers]
NODE has joined #ruby
ElFerna has quit [Ping timeout: 265 seconds]
oz has joined #ruby
lightstalker has joined #ruby
fluxAeon has quit [Ping timeout: 258 seconds]
ur5us has quit [Quit: Leaving]
pupsikov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has joined #ruby
fluxAeon has joined #ruby
fluxAeon has quit [Ping timeout: 255 seconds]
fluxAeon has joined #ruby
bsdbandit-01 has joined #ruby
lightstalker has quit [Ping timeout: 256 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lightstalker has joined #ruby
<phaul>
there is the question of how one represent irrationals precisely (without rounding errors). Then you basically arrive at symbolic math systems like wolfram mathematica is.. whether that's needed in a general purpose language like ruby is probably questionable.
<cahoots>
hi, i'm on ruby 2.7.0, installed via homebrew, and osx catalina, and vim bindings don't work. i've tried editing .editrc and .inputrc, but still no dice. any ideas?
cliluw has joined #ruby
ElFerna has joined #ruby
<havenwood>
phaul: I've wished the same for Ruby, just since I personally don't have space needs for floating points so I'd rather have a rational under the hood for decimal numbers.
jmcgnh has quit [Read error: Connection reset by peer]
<apotheon>
havenwood: Too bad I'd have to use Raku to use Raku.
bsdbandit-01 has quit [Ping timeout: 268 seconds]
<apotheon>
cahoots: I have no idea.
jmcgnh has joined #ruby
<phaul>
still it's pretty basic to calculate the area of a circle with radius 1, then all attempts to keep it precise and get a number rather than a formula out fall short
ElFerna has quit [Ping timeout: 240 seconds]
orbyt_ has joined #ruby
yokel has quit [Ping timeout: 265 seconds]
<phaul>
but I also like this rational by default approach
yokel has joined #ruby
al3xandr0s has left #ruby ["Leaving"]
TCZ has quit [Quit: Leaving]
sergioro has joined #ruby
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]