Hacker News new | ask | show | jobs
by vwwvvw 2783 days ago
> Not array, but list.

First, nobody needs lists in 2018. Lists is a horrible data structure with most operations having bad asymptotic complexity. There are usages in algorithms (skip lists etc), but end-user code just never uses lists. Some pure functional programming languages have a set of compiler passes (that work only for pure functional languages) that allows to work with "lists" but in the end they get abolished from binary. That's not about your programming language.

The magical syntax I'm talking about is just that it has all these `[]` and `[...]` in type. Why can't you make it a generic, like, `array<int>` or `array[int]`?

> The latter is the splicing syntax—shorthand for running a for loop over elements 2 through 4 (exclusive).

Why do you have to use magic syntax, when you could have just made a function with 2 arguments? I mean, Haskell implements `enumFromTo` function and `[a..b]` sugar for it, but your `array[a..b]` is neither first-class (what do you do if you want to make a pointer to this function?) nor short.

> The plan is to make it that way because of how the visual representation of repeated exponents in math works. Your thoughts?

Either that, or just make it non-associative (a ^ b ^ c will be a syntax error then).