Here is code that will work, using the range function, which generates a sequence of numbers from zero up to but not including the number you specify:
This, in fact, mirrors the way it was described in English, but you can also see that you have to write the expression from the “inside out”. You can write the same expression using the ->> threading operator. The ->> operator takes two or more arguments. The first argument is a list, which is used as the last item in the second argument, which is an expression. If there are more arguments, the result of the second expression is used as the last item of the third argument, and so on. In other words, the original list “threads” its way through the expressions, always as the last item. This lets you rewrite the preceding code as follows:
There is also a -> form, known as “thread first”; it works the same as ->> except it inserts the list as the first item in the subsequent expressions.