<FromGitter>
<sam0x17> side note: don't ever do what I just did and move from somewhere where the area code is (e.g.) `ABC` to a place where the area code is `ACB`.. it complicates pizza arriving
<FromGitter>
<christopherzimmerman> If the meetup in Chicago is small, I doubt there is a meetup in central Texas, but who knows, maybe someday.
dwdv_ has quit [Ping timeout: 268 seconds]
<FromGitter>
<christopherzimmerman> Is the Help and Support section of the forum appropriate for code review requests?
<FromGitter>
<Blacksmoke16> Is it a lot?
<FromGitter>
<christopherzimmerman> No, just a small iterator class.
<FromGitter>
<tenebrousedge> we do code review
<FromGitter>
<tenebrousedge> mostly we say, "zomg it's awful, take it away! make it stop!"
<FromGitter>
<tenebrousedge> but we're happy to go into detail :P
<FromGitter>
<christopherzimmerman> Ha, luckily I am aware my crystal coding style sucks, this is more of an algorithmic review :)
<FromGitter>
<christopherzimmerman> That’s just computing setup costs to the actual operation so I can account for it. I only need to speed the operation up by about 3x for it to be competitive with other numerical libraries.
<FromGitter>
<watzon> Ouchy
ht_ has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
ht_ has quit [Quit: ht_]
DTZUZO has quit [Ping timeout: 265 seconds]
absolutejam2 has joined #crystal-lang
tankf33der has joined #crystal-lang
DTZUZO has joined #crystal-lang
DTZUZO has quit [Remote host closed the connection]
absolutejam2 has quit [Ping timeout: 240 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 268 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 265 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 246 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 240 seconds]
repo has quit [Quit: WeeChat 2.5]
repo has joined #crystal-lang
alexherbo2 has joined #crystal-lang
repo has quit [Quit: WeeChat 2.5]
repo has joined #crystal-lang
<FromGitter>
<asterite> what's the idea behind that iterator? (what is it supposed to be doing?)
duane has quit [Remote host closed the connection]
absolutejam2 has quit [Ping timeout: 276 seconds]
duane has joined #crystal-lang
<FromGitter>
<christopherzimmerman> If the array can be treated as flat, a different `next` method gets chosen that just increments by the final stride, and that one is as fast as I would expect, I'm just dealing with the ND case now, and I haven't had any luck improving performance since I came up with the algorithm.
<FromGitter>
<christopherzimmerman> I am hoping I have poorly optimized crystal code rather than a poor algorithm :D
<FromGitter>
<kinxer> @ImAHopelessDev_gitlab My point yesterday was what @Blacksmoke16 said: `some_array.shuffle!` is better than `some_array = some_array.shuffle`.
duane has quit [Ping timeout: 240 seconds]
<Yxhuvud>
for the n-dimensional case, are you iterating in a sensible order with regards to actual layout in memory? for example, in the two dimensional case, iterating over it with one order of dimensions can have vastly different performance than the other order.
<FromGitter>
<christopherzimmerman> Yes. The 2D case is handled a bit differently, by simply using the leading dimension rather than explicit strides. But for the nd-case, I both store and access in row-major order.
<FromGitter>
<bajro17> is it possible get index of "test".count { |i| } without extra variable
<FromGitter>
<Blacksmoke16> what do you want to do?
<FromGitter>
<ImAHopelessDev_gitlab> @kinxer oh yeah, i've used shuffle! a couple times.
<FromGitter>
<ImAHopelessDev_gitlab> Good morning!!
<FromGitter>
<ImAHopelessDev_gitlab> https://play.crystal-lang.org/#/r/7xog/edit wow, didn't know we could do [0, 2] syntax on an array. found out by looking at source of `first` 😍
<FromGitter>
<kinxer> Good morning. :)
<FromGitter>
<tenebrousedge> @ImAHopelessDev_gitlab I often prefer `slice`
<FromGitter>
<ImAHopelessDev_gitlab> oh yeah letme check it out
<FromGitter>
<tenebrousedge> you can also use `arr[0..3]` if you have a range of indexes you're after
<FromGitter>
<tenebrousedge> but I almost always end up using `arr.first(n)` or `last(n)`
<FromGitter>
<ImAHopelessDev_gitlab> damn working with arrays are very easy in crystal. so many nice methods and functionality, it really helps me a lot
<FromGitter>
<ilanpillemer> is not finding a match
<FromGitter>
<kinxer> That'll match any string with four repeating characters.
<FromGitter>
<ilanpillemer> not three?
<FromGitter>
<kinxer> No, because `(.)` matches one.
<FromGitter>
<ilanpillemer> aha!
<FromGitter>
<ilanpillemer> thanks
<FromGitter>
<ilanpillemer> regex is quite a thing
<FromGitter>
<kinxer> No problem.
<FromGitter>
<ilanpillemer> `jwz`has a point
<FromGitter>
<tenebrousedge> please don't say that
<FromGitter>
<tenebrousedge> `jwz` is a jerk who likes to fling mud
<FromGitter>
<tenebrousedge> for a number of years he set up his server so that any links to his site from HN would redirect you to an image of hairy testicles
<FromGitter>
<tenebrousedge> this may still be the case
<FromGitter>
<kinxer> Yeah, I had to look up who you're talking about, but a quick look through his WikiQuotes page doesn't leave me encouraged about his character.
dwdv_ has joined #crystal-lang
<FromGitter>
<greenbigfrog> Any reason why `Regex::MatchData#first` doesn't exist?
<FromGitter>
<greenbigfrog> `"ABC CDF".scan(/\b\S/).map { |x| x[0]}.join` is there a more efficient/better looking way of getting the first character of each word in a string?
<FromGitter>
<tenebrousedge> `"ABC CDF".scan(/\b\S/).join &.[0]` is probably as close as you get
<FromGitter>
<greenbigfrog> Thanks
<FromGitter>
<tenebrousedge> you could also use an `Iterator` and `string_scanner`
<FromGitter>
<tenebrousedge> but that's probably overengineering things
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
return0e_ has joined #crystal-lang
duane has quit [Ping timeout: 240 seconds]
<hightower3>
Hey folks did option "API" disappear from the menu at top of https://crystal-lang.org/ ?
<FromGitter>
<kinxer> Yes. It's under "Docs" now (along with the GitBook documentation).
<hightower3>
thanks
<FromGitter>
<kinxer> I'm a little torn, since I think it makes the website a little more cleaner visually, but it also slows me down.
<hightower3>
just to confirm, the discussion from the other day was correct in saying that the best way to alias a method to a different name is to define a new method (with different name) and call the real one one?
<FromGitter>
<tenebrousedge> apparently
<hightower3>
yeah, the removed alias_method macro seemed to do exactly that
<FromGitter>
<tenebrousedge> nothing stopping you from using the macro, either
<hightower3>
yes, will use it
<hightower3>
Is there a way to use this custom "alias_method" macro either directly before (like documentation) or directly after the method definition, so that it automatically knows which function is being aliased and that I don't have to repeat the name?
<FromGitter>
<tenebrousedge> can you detect the last method defined in a macro?
<FromGitter>
<tenebrousedge> or the next?
<FromGitter>
<Blacksmoke16> yea prob
<FromGitter>
<Blacksmoke16> `method[idx + 1]`?
<FromGitter>
<tenebrousedge> o__o
<FromGitter>
<Blacksmoke16> where `methods` is the array of methods
<hightower3>
fabulous
<hightower3>
macro alias_method(new) {{ method[idx+1] }} #=> undefined macro variable 'method'. I see {{method...}} used in crystal's sources, what might be missing in my case?
<hightower3>
ah it's only used as variable that's previously defined, not as magic word
<FromGitter>
<Blacksmoke16> i mean its more code than that
<hightower3>
maybe 'methods'
<FromGitter>
<Blacksmoke16> would have to do like ⏎ `{% methods = @type.methods %}`
<hightower3>
yeah. just gotten to that, thanks!
<FromGitter>
<Blacksmoke16> then could find the one you want, then get the next one
<hightower3>
yes, yes, I see an example in spec/compiler/codegen/macro_spec.cr
<FromGitter>
<bew> I'd suggest `.last` instead of `[-1]` for clarity
<hightower3>
hehe was thinking about it, will do, thanks
<FromGitter>
<Blacksmoke16> Well won't that just alias the last method all the time?
<hightower3>
Yes, after I define a method, I follow it immediately with alias_previous(new_name)
<hightower3>
So this way I don't have to mention new and old name on each line
<hightower3>
Also for cases when some methods have multiple aliases, I've changed the macro to do a for loop, so now it supports alias_previous n1, n2, n3