For any f, acc, and lst, (foldl f acc lst), from left-to-right, applies to f to each element of lst and the current accumulated value. The initial accumulator is acc so the second intermediate accumulated value is (f (first lst) acc). Replacing f, acc, and lst with your arguments, the second intermediate accumulated value in your example is (list 'a1 '()), and so on.
On Wed, Jul 29, 2015 at 10:09 AM, <sagyo12341...@gmail.com> wrote: > Sorry Stephen, > > I expected, > >> (foldl (lambda (x y) (list x y)) () '(list a1 a2 a3 a4 a5)) > (list (list (list (list (list a1 a2) a3) a4) a5). > > it may be a problem in non-commutative operations. > > Taro > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.