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

Fucking Haskell and zips

Name: Anonymous 2011-04-23 14:08

So,

Haskell                          | Lisp
zip      l1 l2                   | (map list l1 l2)
zip3     l1 l2 l3                | (map list l1 l2 l3)
zip4     l1 l2 l3 l4             | (map list l1 l2 l3 l4)
zip5     l1 l2 l3 l4 l5          | (map list l1 l2 l3 l4 l5)
zip6     l1 l2 l3 l4 l5 l6       | (map list l1 l2 l3 l4 l5 l6)
zip7     l1 l2 l3 l4 l5 l6 l7    | (map list l1 l2 l3 l4 l5 l6 l7)
N/A                              | (map list . ls)
map      f  l                    | (map f l)
zipWith  f  l1 l2                | (map f l1 l2)
zipWith3 f  l1 l2 l3             | (map f l1 l2 l3)
zipWith4 f  l1 l2 l3 l4          | (map f l1 l2 l3 l4)
zipWith5 f  l1 l2 l3 l4 l5       | (map f l1 l2 l3 l4 l5)
zipWith6 f  l1 l2 l3 l4 l5 l6    | (map f l1 l2 l3 l4 l5 l6)
zipWith7 f  l1 l2 l3 l4 l5 l6 l7 | (map f l1 l2 l3 l4 l5 l7)
N/A                              | (map f . ls)


All this shit to achieve what Lisp does with ONE function? That is 6 lines of actual code in a naive implementation? Seriously?

(define map
 (case-lambda
  ((f xs)
   (do ((xs xs (cdr xs))
        (r '() (cons (f (car xs)) r)))
     ((null? xs) (reverse r))))
  ((f . xss)
   (do ((xss xss (map cdr xss))
        (r '() (cons (apply f (map car xss)) r)))
     ((ormap null? xs) (reverse r))))))

Name: Anonymous 2011-04-23 16:00

In Lisp you can just define a curry function if you want currying (unless there's already one in there; I'm no Lisp expert). Jeez.

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