Can someone explain to me the syntax rules governing the iterate expression? I understand that the function takes 1 argument, since x is the only arg being utilized, but how does the language, and the reader, know that the first argument is an iterator, and not some value to be passed to the function?
The language knows that the function is monadic (takes a single variable as input), knows that you’ve passed two arguments and knows that you’re iterating using over (/). Thus it will check the first input variable: if it’s an integer/long it will run the iteration that many times, if it’s a function/lambda/projection that produces a boolean output then it continues so long as the boolean is true.
Similarly if you only input a single argument it knows to iterate until convergence (same result appears twice in a row).