add CI action; rm stale files
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
|
||||
# Vectors
|
||||
|
||||
|
||||
@@ -712,6 +713,12 @@ The style generally employed here is to use plural variable names for a collecti
|
||||
|
||||
Vectors in `Julia` are a container, one of many different types. Another useful type for programming purposes are *tuples*. If a vector is formed by placing comma-separated values within a `[]` pair (e.g., `[1,2,3]`), a tuple is formed by placing comma-separated values withing a `()` pair. A tuple of length $1$ uses a convention of a trailing comma to distinguish it from a parenthesized expression (e.g. `(1,)` is a tuple, `(1)` is just the value `1`).
|
||||
|
||||
:::{.callout-note}
|
||||
## Well, actually...
|
||||
Technically, the tuple is formed by the use of commas, which separate different expressions. The parentheses are typically used, as they clarify the intent. In a notebook interface, it is useful to just use commas to separate values to output, as typically the only the last command is displayed. This usage just forms a tuple of the values and displays that.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
Tuples are used in programming, as they don't typically require allocated memory to be used so they can be faster. Internal usages are for function arguments and function return types. Unlike vectors, tuples can be heterogeneous collections. (When commas are used to combine more than one output into a cell, a tuple is being used.) (Also, a big technical distinction is that tuples are also different from vectors and other containers in that tuple types are *covariant* in their parameters, not *invariant*.)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user