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

how do i shot arrow???

Name: Anonymous 2007-02-03 12:27

*** ??? &&&

Nah, just kidding, I kinda get them.

liftA2 :: (Arrow a) => (b -> c -> d) -> a e b -> a e c -> a e d
liftA2 p f g = f &&& g >>> (arr . uncurry) p

split :: Eq a => a -> [a] -> [[a]]
split _ [] = []
split d l  =
  ((dropWhile (== d)) ^>> (liftA2 (:) (takeArrow d) (dropArrow d >>^ (split d)))) l
  where
  takeArrow d = arr . takeWhile $ (/= d)
  dropArrow d = arr . dropWhile $ (/= d)


I wonder if this is what they are supposed to be used for though ;)  And I realized that functions are actually arrows already after writing this :/

Name: Anonymous 2007-02-04 1:38

>>1
Do a barrel roll!

import Control.Arrow

split :: Eq a => a -> [a] -> [[a]]
split d =
    barrelRoll ((fmap fst . takeWhile (/=([],[])) . snd) &&&
                (uncurry (:) . (uncurry (***)
                                ((id &&& (fmap . (flip (.) snd)))
                                 ((break (== d)) . (dropWhile (== d)))))))
    where
      barrelRoll = loop

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