iterate question

Question is on the highlighted statement below:

  1. Does the argument (like the scan operation) become the previous output of the command i.e. the orange highlight becomes the parameter to f to yield the blue highlight ?

  2. In the same output mentioned in q1 above, does the program stop because machine because of 2 reasons:

     1. 1e-256 squared leads a 0

     2. two 0s are not printed because it would violate the rule in violet below

  1. Please confirm : “value matching the argument” is a subset of the “last seen is produced” clause , because “next value” is the " function applied to the previous value"  and hence “previous value” is the argument for the “next value”. Better explained in question 4 below.

  2. In the yellow highlight below, it does not mention that the first output will be the argument itself

iterate

If f is a  monadic  function, f\ calls f on its argument repeatedly until a value matching the argument or the last seen is produced. The result is the argument followed by all the results except the last. For example:

q)(neg\)11 -1q)(rotate[1]\)"abcd"("abcd";"bcda";"cdab";"dabc")q)({x\*x}\)0.10.1 0.01 0.0001 1e-08 1e-16 1e-32 1e-64 1e-128 1e-256 0q){x\*x}\[0.1] / alternate syntax0.1 0.01 0.0001 1e-08 1e-16 1e-32 1e-64 1e-128 1e-256 0

W

A4. If f is a  monadic  function, f\ calls f on its argument repeatedly until a value matching the argument or the last seen is produced. The result is the argument followed by all the results except the last.


q){mod[x+1; 3]}[0] / stops when it cycles back to zero (the argument)

0 1 2
q){x+1}\[0] / monotonically increasing sequence that goes OOM
wsfull



Yan Yan, you are the best :-) . Thanks for the excel explanation.

Regarding the argument being in the result question. My initial question was maybe not clear and in-fact its not really a question, but more of a comment. If you see below (I feel), the two highlights contradict each other. If you go by the first sentence, you will not arrive at the second highlight conclusion logically (or maybe I cant even see the logic). A moot point… if anyone cares to answer.