Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 09:17
    lbguilherme synchronize #10768
  • May 23 19:35
    lbguilherme synchronize #10768
  • May 23 19:06
    lbguilherme synchronize #10768
  • May 23 18:47
    lbguilherme synchronize #10768
  • May 23 18:46
    lbguilherme synchronize #10768
  • May 23 13:02
    Blacksmoke16 labeled #12066
  • May 23 13:02
    Blacksmoke16 labeled #12066
  • May 23 11:16
    lbguilherme opened #12067
  • May 23 07:58
    mig-hub labeled #12066
  • May 23 07:58
    mig-hub opened #12066
  • May 23 06:55
    straight-shoota closed #12033
  • May 23 06:54
    straight-shoota closed #12040
  • May 23 06:54
    straight-shoota edited #12040
  • May 23 06:52
    straight-shoota synchronize #11984
  • May 23 06:52
    straight-shoota synchronize #11947
  • May 23 06:51
    straight-shoota closed #12064
  • May 23 06:51
    straight-shoota closed #12058
  • May 23 06:51
    straight-shoota milestoned #12064
  • May 22 13:27
    Blacksmoke16 labeled #12065
  • May 22 13:27
    Blacksmoke16 labeled #12065
Emilia
@rymiel:rymiel.space
[m]
omg it even tells me the command to run a failed spec for each failed spec... i'm just blind
George Dietrich
@Blacksmoke16
:sweat_smile:
mfiano
@mjfiano:matrix.org
[m]
Is there a decent way to call a method with arguments being the elements of a (small) StaticArray? I'm coming up with hacky stuff without diving into macros
George Dietrich
@Blacksmoke16
if you used a tuple you could *tuple
mfiano
@mjfiano:matrix.org
[m]
Sort of like splatting, but without a tuple or intermediary sequence
George Dietrich
@Blacksmoke16
arr[0], arr[1]
mfiano
@mjfiano:matrix.org
[m]
Yeah I thought I could do function application from the result of a functional map or something
Oh well
are tuples stack objects or are they collected?
George Dietrich
@Blacksmoke16
stack
ofc if you used a struct you could just pass the struct thru and use its getters
mfiano
@mjfiano:matrix.org
[m]
i would assume a tuple is fixed in length then
George Dietrich
@Blacksmoke16
yes
mfiano
@mjfiano:matrix.org
[m]
Ok good
mfiano
@mjfiano:matrix.org
[m]
What are the performance characteristics compared to a StaticArray?
George Dietrich
@Blacksmoke16
not sure, probably similar?
mfiano
@mjfiano:matrix.org
[m]
Yes, I am there. That page is nearly empty :)
George Dietrich
@Blacksmoke16
API docs have a bit more info
mfiano
@mjfiano:matrix.org
[m]
I see. Main difference I see is SA is a homogeneous container, which might be more contiguous/better for cache
From IRC (bridge bot)
@FromIRC
<straight-shoota> @mjfiano What exactly do you want to do?
mfiano
@mjfiano:matrix.org
[m]
straight-shoota: I'm pretty new, just experimenting mostly. But right now I have Vector (math) types in 2-4 dimensions, and currently using separate float ivars. Would like to back their storage in some container, so the method logic can map over them and reduce code by being generic for all 3 types.
mfiano
@mjfiano:matrix.org
[m]
Most operations are element-wise, so could reduce quite a bit of code by iterating over a generic container of some size to produce results for a given operation/vector type.
THat is the idea anyway. Not sure where to start yet :)
George Dietrich
@Blacksmoke16
fwiw its fairly easy to make a struct that is iterable
mfiano
@mjfiano:matrix.org
[m]
Interesting
George Dietrich
@Blacksmoke16
that you could use with .each or .mapetc
mfiano
@mjfiano:matrix.org
[m]
I need to learn that too then
So how does that work? Is it an abstract type where I have to implement some methods?
George Dietrich
@Blacksmoke16
its a module that you include in your type, an implement a method
2 methods*
1 that returns the size of your container, and another that gets the value at the given index
mfiano
@mjfiano:matrix.org
[m]
Oh does that page say which 2 methods?
George Dietrich
@Blacksmoke16
search for abstract
mfiano
@mjfiano:matrix.org
[m]
Oh that's very nice.
Thank you
George Dietrich
@Blacksmoke16
makes it super easy to do like arry.sort!
mfiano
@mjfiano:matrix.org
[m]
I am beginning to see how Crystal is very extensible with these mixin modules
mfiano
@mjfiano:matrix.org
[m]
It seems I have to study generic type parameters more because the compiler can't infer the type parameter and I'm not sure what to specify.
mfiano
@mjfiano:matrix.org
[m]
Heh, you're right. That is easy. I do have one complaint about the compiler here though.
George Dietrich
@Blacksmoke16
oh?
mfiano
@mjfiano:matrix.org
[m]
When i include Indexable(T), the compiler was smart enough to tell me I didn't implement unsafe_fetch. After I implemented that and tried using it, the compiler ended up overflowing the stack due to recursing infinitely. It wasn't until I implemented size that it worked. It makes me wonder why it just blew the stack instead of complaining that I didn't implement size.
George Dietrich
@Blacksmoke16
hm
got a small example of that behavior? I have a theory
From IRC (bridge bot)
@FromIRC
<straight-shoota> The problem is that Indexable#size is actually implemented by it's ancestor Enumerable#size
mfiano
@mjfiano:matrix.org
[m]
I will make one on play
George Dietrich
@Blacksmoke16
yea that was my guess ^ which its implementation just iterates the whole thing to figure out
From IRC (bridge bot)
@FromIRC
<straight-shoota> Relevant issues are crystal-lang/crystal#10014