Does it make sense to use + for list concatenation?

@socks I feel like the behaviour we would intuitively expect would be that {1,2,3}+{4,5,6} yields {5,7,9}
-F

@Felthry Ah, so the same operation but lifted! I guess that would make sense

@socks we're also very used to matlab though, it might be less intuitive for others

matlab is heavily matrix-oriented so operations generally behave as they would on matrices; that's just how matrix addition and subtraction work. * is matrix multiplication, and / is actually a complicated operator that computes the inverse of the matrix on the right and left-multiplies it by the matrix on the left (there's also \ for inverting the matrix on the left instead)
-F

@socks it does have the useful feature that putting a . before any operator performs that operation separately on every element of two equal-sized matrices. So .+ and .- are the same as + and - but A .* B multiplies A₁₁ by B₁₁ and A₁₂ by B₁₂ etc, which is a really handy thing to have a dedicated syntax for instead of some function name you have to remember
-F

@socks maybe that's a really common thing i dunno

matlab is the only high-level language we usually work in
-F

@Felthry Well, Matlab is extremely domain-specific. When I talk about programming concepts I talk about stuff that can apply to many programming languages for many different purposes

@socks yeah i'm just talking about what we know, and adding the caveat that our knowledge is limited
-F

Follow

@socks and realizing while talking that we may have been assuming matlab is more similar to other programming languages than it probably is
-F

Sign in to participate in the conversation
Awoo Space

Awoo.space is a Mastodon instance where members can rely on a team of moderators to help resolve conflict, and limits federation with other instances using a specific access list to minimize abuse.

While mature content is allowed here, we strongly believe in being able to choose to engage with content on your own terms, so please make sure to put mature and potentially sensitive content behind the CW feature with enough description that people know what it's about.

Before signing up, please read our community guidelines. While it's a very broad swath of topics it covers, please do your best! We believe that as long as you're putting forth genuine effort to limit harm you might cause – even if you haven't read the document – you'll be okay!