I am a beginner and I am trying to understand the primitive function foldl/foldr. I read the documentation and tried some things. However, I just cannot grasp its behavior in this case:
(foldl expt 2 '(1 2 3 4))
>> 262144
I think the result should be the same as:
(expt (expt (expt (expt 2 1) 2) 3) 4)
>> 16777216
I can't trace foldl since the function is a primitive. I do not see how the procedure achieves this result. I am using Racket and Dr. Racket.