Syntax for arrays?

I'm a little confuzzled on what my syntax for my language should be. Mainly when it comes to arrays.

I don't know if I want predefined functions, or built in syntax. Like this:

The built in syntax definitely looks shorter, but it doesn't really look clean when you're working with an r-value array:

I personally prefer the built in functions for r-value arrays, but the built in syntax for variables.

So which one should I chose? I can't do both

You are viewing a single comment. View All

@DynamicSquid Nevermind, the first 'S' in SLL threw me off.

It depends, you can save memory depending on the specific situation.
Usually, you might lose on memory though.

Appending and prepending are always very fast operations.

Iterating is slow.

Take, for example, concatenation between three arrays, ex:

If you were required to have contiguous blocks of memory, then you would have to allocate memory by summing the lengths of all of the individual arrays, then copy the memory into the new array, and assign the variable.

If instead, it was implemented as SLL or DLL, you would simply modify the value that the first array pointed to, and so on. No copies, no reallocations, no variable reassignment.

But I hear that, for complex, performance-critical operations, the performance is terrible.

Ex: Haskell uses LL strings and is a compiled language, but, Python uses blocks, and is interpreted, yet is more performant.