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

Fold

Name: Anonymous 2008-02-02 15:04

http://www.haskell.org/haskellwiki/Fold
Haskell has map in terms of 'foldr ((:) . f) []'

How would you implementd foldr, and then map with foldr in scheme/lisp?

Name: Anonymous 2008-02-02 16:27

>>8
> ((compose sqr sub1) 5)    
24

(define (compose . l)
  (lambda (x)
    (foldr (lambda (f x) (f x)) x l)))

((compose sqr sub1) 5)
16



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