Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Haskell --- average of a list.

Name: Anonymous 2015-07-08 17:53

Rules:

✡ must compute arithmetic average of a list
✡ only one pass is allowed
✡ constant memory

Name: Anonymous 2015-07-08 18:28

hows this?

(\(y,s) -> y`div`s)) . foldl' (\(tot,len) x -> (tot+x,len+1)) (0,0)

not sure what you mean by "arithmetic average", change div to / if you want

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List