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

Why did the origami artist never map?

Name: Anonymous 2012-10-16 1:27

Because he preferred to fold.

Name: Anonymous 2012-10-16 1:42

I smirked.

Name: Anonymous 2012-10-16 1:54

I stabbed myself in the eye!

Name: Anonymous 2012-10-16 2:32

Terrible!

Name: Anonymous 2012-10-16 4:13

map = (flip foldr) [] . ((.) (:))

hasukeru kawaii ((^).(^))

Name: Anonymous 2012-10-16 22:15

le fold face

Name: Anonymous 2012-10-16 22:34

>>5
map = flip foldr [] . fmap (:)

Haskell is not LISP. You don't need 4 pairs of parentheses for this.

Name: Anonymous 2012-10-16 22:45

>>5,7
If you're going to use fmap, you might as well just do:
map = fmap

And before >>5 tries to say he didn't use fmap, (.) is just a specialized version of fmap, in the same way that map is.

Name: Anonymous 2012-10-16 23:45


(define (map1 fn lis)
  (reverse (fold (lambda (acc x)
                   (cons (fn x) acc))
                 '()
                 lis)))

Name: Anonymous 2012-10-17 2:36

>>9
there are only two basic operations: fold and unfold. prove me wrong.

Name: Anonymous 2012-10-17 3:00

>>10
ヨ鵜あれwろんg!

Name: Anonymous 2012-10-17 3:20


(define (fold fn x lis)
  (if (null? lis)
    x
    (fold fn (fn x (car lis)) (cdr lis))))

(define (reverse lis)
  (fold (lambda (acc x)
          (cons x acc))
        '()
        lis))

(define (map1 fn lis)
  (reverse (fold (lambda (acc x)
                   (cons (fn x) acc))
                 '()
                 lis)))

(define (zip lis acc)
  (cond ((null? lis) '())
        ((null? (car lis)) (reverse acc))
        (else (zip (map1 cdr lis)
                   (cons (map1 car lis) acc)))))

(define (map fn . argss)
  (map1 (lambda (args)
          (apply fn args))
        (zip argss '())))

Name: >>12 2012-10-17 3:24

I want to make a non recursive zip that uses fold and map1

Name: Anonymous 2012-10-17 6:38

NIGGERS AND MORE NIGGERS!

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