# Beginner help

Iavor S. Diatchki diatchki@cse.ogi.edu
Tue, 11 Feb 2003 09:08:42 -0800

```hi,

nice post.

David Roundy wrote:
> ...
> btw, in my experience, I've found that a useful metric for how
> "functionally" I am thinking is the frequency with which I use map, foldl
> and friends.  At first they seemed really confusing (and I still get
> couldn't tell you the difference between foldl and foldr without looking it
> up), but when you get used to them they can cut the quantity of code you
> need to write dramatically.

maybe this will help with the foldl/foldr confusion:

foldl (-) 0 [1,2,3,4] = (((0 - 1) - 2) - 3) - 4
foldr (-) 0 [1,2,3,4] = 1 - (2 - (3 - (4 - 0)))

foldl groups things to the left, while foldr groups them to the right.

hope this helped
bye
iavor

--
==================================================
| Iavor S. Diatchki, Ph.D. student               |
| Department of Computer Science and Engineering |
| School of OGI at OHSU                          |
| http://www.cse.ogi.edu/~diatchki               |
==================================================

```