How to create and populate Kotlin lists (initialize mutable and immutable lists) alvin November 4, 2018 - 12:06pm

If you ever need to create and populate a Kotlin list, I can confirm that these approaches work for an immutable and mutable lists:

// fill an immutable list
val doubles = List(5) { i -> i * 2 }

// fill a mutable list of ten elements with zeros
val ints = MutableList(10) { 0 }

The Kotlin REPL shows how these approaches work:

AppleScript list manipulation examples

AppleScript list FAQ: How do I create lists in AppleScript?

There are several different ways to create AppleScript lists. Let's take a look at a few examples.

AppleScript list creation examples

Here's a quick example of a few different AppleScript lists. First, some favorite foods:

set favoriteFoods to {"cookies", "cake", "cereal"}

Next, some of those other foods:

LaTeX example - enumerate and itemize line spacing

LaTeX line spacing FAQ: How can I control the line spacing in itemize and enumerate tags?

What I did was to create my own LaTeX command, and then use that command instead of the traditional enumerate tag. (This works just as well for the itemize tag.)

The LaTeX example below shows how to create your own command named packed_enum. After you define this command, just use it instead of enumerate or itemize, and your line spacing will essentially be reduced to single line spacing.