havenwood changed the topic of #ruby to: Ruby 3.4.3, 3.3.8 https://www.ruby-lang.org | Log https://libera.irclog.whitequark.org/ruby
msv has quit [Ping timeout: 248 seconds]
msv has joined #ruby
Linux_Kerio has quit [Ping timeout: 276 seconds]
johnjaye has quit [Remote host closed the connection]
johnjaye has joined #ruby
shiru has joined #ruby
<o0x1eef> nakilon: Can you provide an example?
crespire has quit [Remote host closed the connection]
Sheilong has quit []
gr33n7007h has quit [Quit: WeeChat 4.6.2]
gr33n7007h has joined #ruby
ua_ has quit [Excess Flood]
ua_ has joined #ruby
jmcantrell has quit [Quit: WeeChat 4.6.2]
oznek has quit [Remote host closed the connection]
msv has quit [Quit: Leaving]
msv has joined #ruby
kerzhak has quit [Remote host closed the connection]
infinityfye has joined #ruby
kerzhak has joined #ruby
gr33n7007h has quit [Ping timeout: 265 seconds]
gr33n7007h has joined #ruby
dza0 is now known as dza
infinityfye has quit [Read error: Connection reset by peer]
infinityfye has joined #ruby
schne1der has quit [Ping timeout: 244 seconds]
gemmaro has quit [Ping timeout: 252 seconds]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Read error: Connection reset by peer]
gemmaro has joined #ruby
Linux_Kerio has joined #ruby
andy-turner has joined #ruby
schne1der has joined #ruby
GreenResponse has joined #ruby
brokkoli_origin has quit [Remote host closed the connection]
Pixi` has joined #ruby
Pixi has quit [Ping timeout: 260 seconds]
brokkoli_origin has joined #ruby
andy-turner has quit [Quit: Leaving]
andy-turner has joined #ruby
andy-turner has quit [Remote host closed the connection]
andy-turner has joined #ruby
andy-turner has quit [Client Quit]
andy-turner has joined #ruby
andy-turner has quit [Remote host closed the connection]
andy-turner has joined #ruby
<nakilon> henk: if user is supposed to git clone your repo and run it, he should be ok with any versions of the gems there, because they rely on you and that you've already checked them
andy-turner has quit [Quit: Leaving]
andy-turner has joined #ruby
<nakilon> the "to leave it up to people" sounds like the case of the repo that is a library, i.e. people don't launch it from the repo root, and they have their own Gemfile and use your thing as a dependency; in that case your Gemfile and Gemfile.lock will be just ignored, even if they are included in the gem that you've published
<nakilon> I had a case though, when the repo had Gemfile.lock and it somehow was colliding with my Gemfile, not sure how that worked, maybe because I was sourcing from a :path; weird stuff
<nakilon> i.e. answering your last question, basically, Gemfile and Gemfile.lock are both ignored when they use your project as a dependency running another app from another directory
<o0x1eef> More or less what has been said already :D But this is from the original author of Bundler itself.
Furai has quit [Quit: WeeChat 4.6.2]
Furai has joined #ruby
infinityfye has quit [Read error: Connection reset by peer]
aindilis_ has joined #ruby
aindilis has quit [Ping timeout: 276 seconds]
crespire has joined #ruby
shiru has quit [Remote host closed the connection]
<henk> nakilon, o0x1eef: thanks! I’ll have to meditate on that input for a while, I think. and read more about what bundler and gems really are …
Pixi` has quit [Quit: Leaving]
Pixi has joined #ruby
Pixi has quit [Read error: Connection reset by peer]
Pixi has joined #ruby
user71 has joined #ruby
oznek has joined #ruby
<o0x1eef> Sounds good ;)
<havenwood> henk: I'd suggest adding the actual dependencies to your gemspec, that's standard. Put a `gemspec` directive in your `Gemfile` file.
<havenwood> It's optional whether you `git rm Gemfile.lock` and add it to your .gitignore. The community is split.
<havenwood> Bundler's current guidance is commit the Gemfile.lock but RubyGem's was to not commit. I typically do not commit it unless there's some dependency issues I'm aware of, but whether you commit it is less important than other things.
<o0x1eef> My approach is to follow yehuda's advice more or less exactly.
<havenwood> o0x1eef: Yeah, I prefer it to Yahuda's logic to current Bundler too.
<havenwood> I think the important thing here is to `add_dependency` for your real deps in your `.gemspec` file and `gemspec` to your `Gemfile` then `bundle`.
<havenwood> o0x1eef: I mean, I agree. :)
<o0x1eef> :D
<havenwood> Rereading what I wrote I need coffee. Haha.
<o0x1eef> I think he makes a well reasoned argument for not commiting Gemfile.lock for gems.
<henk> thanks!
<henk> this is about an app, and what’s more, an app that does (at least currently) not really have devel, testing, production environments but is distributed to other people to run. and also may be packaged by (linux) distributors. also, at least until I feel more "at home" in the codebase, will not be distributed (by me) as a Gem or using bundle. ATM people are just supposed to clone the repo and run it
<henk> from there, likely with dependencies satisfied by their system’s ruby packages, where the Gemfile is not respected anyway … currently I have no idea what’s best for this situation but I hope that changes when I have read more about bundler and gems. I’ll likely be back with more questions then, though (:
<havenwood> henk: Add a `gemspec` line to your Gemfile, and you can act like it's a gem with `add_dependency` lines.
<havenwood> Then you can gradually make it a gem as you see fit. Install it locally at first, install it from GitHub, push it to RubyGems proper.
<henk> see, there is why I need to read: I have no idea what "act like it’s a gem" even means :D I’m absolutely clueless about ruby tooling, even as a user, let alone as a maintainer …
<o0x1eef> There's also add_dependency | add_runtime_dependency (they're the same) but also add_development_dependency. So for a gem, you rarely need anything except 'gemspec' in your Gemfile because the gemspec can manage all of it. There might be odd exceptions to this. As a general rule though this works.
<o0x1eef> I'm at odds with havenwood on this one though :)
jmcantrell has joined #ruby
<havenwood> o0x1eef: Some extended discussion here, and I can think of a more recent thread but can't find it at the moment. https://github.com/rubygems/rubygems/issues/1104
<havenwood> I'd consider `add_development_dependency` entirely optional, but I'm not going to PR to switch or anything since it's in the "tradition versus removing duplication" category I think.
<havenwood> I think we can agree `add_dependency` should be used! A Gemfile is technically optional for a gem. I use it for development dependencies, since Bundler was added to RubyGems and I consider it more "modern" practice.
<havenwood> o0x1eef: I used to do exactly like you prefer, I think. I've migrated to Gemfile for dev deps in recent years, but I don't think it much matters.
<o0x1eef> Exactly. It doesn't really matter :)
<havenwood> +1
<havenwood> TIMTOWTDI!
<havenwood> There are bad ways, but a couple totally fine options here.
<o0x1eef> In Ruby. Always.
oznek_ has joined #ruby
oznek has quit [Ping timeout: 265 seconds]
<nakilon> > well reasoned argument for not commiting Gemfile.lock
<nakilon> meanwhile we people are locking the ruby version, smh
<nakilon> if I have an array ABCDE, how do I get these pairs nicely? AB AC AD AE BA BC BD CA CB DA DB EA ?
<nakilon> i.e. this triangle without the main diagonal: https://i.imgur.com/0ZhRxl0.png
oznek__ has joined #ruby
oznek_ has quit [Ping timeout: 276 seconds]
<sam113101> what's that triangle?
<sam113101> do the Xs mean you don't want AA, BB, etc.?
<testone> nakilon: p=[] ; [1,2,3,4,5].combination(2) {|i| p.push i} ; p
<testone> is it what you need?
<sam113101> looks like he wants a permutation at first glance
<sam113101> I'm so glad ruby has those lol
<testone> [inside myself I voted for him writing wrongly the pairs :D]
<nakilon> testone: you've excluded the correct diagonal but took wrong triangle
<nakilon> answer should have 12 itmes
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
andy-turner has quit [Quit: Leaving]
andy-turner has joined #ruby
andy-turner has quit [Quit: Leaving]
andy-turner has joined #ruby
<testone> with:
<testone> a=%w(a b c d e); a_bis=a.dup
<testone> this is the only thing I could think of:
<testone> p=[]; a.each {|i| p+=(a_bis-[i]).map {|j| [i,j]}; a_bis.pop}
<nakilon> LLM is so useless https://i.imgur.com/jgvWHFj.png
<testone> if there is some specific matrix/vector/daru method to do it, I donno
<testone> nakilon: a suggestion, if you really like to use imgur instead of any other file hosting service not forcing you to see web page, you can substitute host like this --> https://rimgo.vern.cc/jgvWHFj.png
<testone> and you can see just image like it should be
<nakilon> I always wondered why imgur opens to everyone with full page; it's been years for me the direct links are opening directly; even if I disable the browser extensions; I have no idea why it is like that
<testone> or you have not disabled the extension that actually do the job
<testone> or you have a 'cheated' /etc/hosts
<testone> or your browser is obscure or you changed user agent to something imgur serves image directly
<nakilon> maybe you use bad browser, like firefox
<testone> wget is as bad as firefox
<testone> you need to change wget user agent too, if you want the image only
<o0x1eef> I use firefox :D
<o0x1eef> Because fuck monopolies
<testone> I would like to use some years ago firefox, but dreams are dreams
<nakilon> see the full page of imgur with ads if you insist
<testone> I don't see either, I use the alternative interfaces, like that I pasted
<testone> or I use something like wget -U c if I need to download
<havenwood> nakilon: There's no single stdlib method to produce that output given that input. I'd use Matrix, personally.
jmcantrell has quit [Ping timeout: 276 seconds]
<havenwood> If you don't mind a `require 'matrix'` I find #diagonal an elegant way to get the diagonal.
<havenwood> Just as an example, consider: Matrix.rows(('a'..).first(5*5).each_slice(5).to_a).each(:diagonal).to_a
<nakilon> => ["a", "g", "m", "s", "y"] # what is that?
<havenwood> nakilon: Look at the output of: ('a'..).first(5*5).each_slice(5).to_a
<havenwood> It's the diagonal.
<nakilon> ok but I need the rest of the elements ..D
<havenwood> nakilon: I don't think I follow. You want the diagonal elements and the not-diagonal elements as two separate lists? Is the input actually a String?
<havenwood> I don't get the talk of a triangle. Show another example input and expected output? Sounds like something you'll need to write a little method for, in any case.
<havenwood> Or never mind if you have a good solution. :)
<nakilon> havenwood: imagine that the rows and cols are numbered as ABCDE starting from the left top corner
<nakilon> you need to obtain the 12 elements of the left-upper triangle
fantazo has joined #ruby
jmcantrell has joined #ruby
cappy has joined #ruby
<nakilon> a.flat_map.with_index{ |e, i| [e].product a[i+1..a.size-i-1] }.then{ |_| _ + _.map(&:reverse) }
jmcantrell has quit [Ping timeout: 260 seconds]
oznek__ has quit [Remote host closed the connection]
oznek__ has joined #ruby
<havenwood> nakilon: Gotcha, that makes sense. 👍
jmcantrell has joined #ruby
GreenResponse has quit [Quit: Leaving]
jmcantrell has quit [Ping timeout: 265 seconds]
<nakilon> o0x1eef: not sure when I'll come up with the example about the "method namespaces"; I'm trying to implement genetic algorithm and the methods within the namespace would be the possible values of the gene, like the eye color, just for the traits that describe the behaviour of the specie in a more complex way than a Numeric; i.e. there will be a pool of possible traits (methods) that the
<nakilon> gene is pointing at via... the name of the method or rather the method object since it's a possible thing in the language
<nakilon> I've just started with a simple example to see that the framework works https://gist.github.com/Nakilon/915e7881a09e4407d4785ca608e0129b -- the traits here are just numbers yet
user71 has quit [Quit: Leaving]
infinityfye has joined #ruby
andy-turner has quit [Quit: Leaving]
andy-turner has joined #ruby
andy-turner has quit [Remote host closed the connection]
andy-turner has joined #ruby
cappy has left #ruby [Leaving]
jmcantrell has joined #ruby
infinityfye has quit [Read error: Connection reset by peer]
<testone> is there a reason you use the symmetry to generate the second half of the 'triangle'?
<testone> nakilon: is it faster then
<testone> a.flat_map.with_index {|e, i| [e].product a[...a.size-i]-[e]}
<testone> or similar direct generation?
andy-turner has quit [Quit: Leaving]
<nakilon> idk, it fulfils my needs
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
jmcantrell has quit [Ping timeout: 252 seconds]
wbooze_ has joined #ruby
wbooze has quit [Ping timeout: 252 seconds]
wbooze_ is now known as wbooze
Linux_Kerio has quit [Ping timeout: 244 seconds]