Upcoming SlideShare
×

Like this presentation? Why not share!

# Arrow

## on Oct 30, 2008

• 2,030 views

### Views

Total Views
2,030
Views on SlideShare
1,838
Embed Views
192

Likes
1
15
0

### 2 Embeds192

 http://d.hatena.ne.jp 191 http://www.slideshare.net 1

### Report content

• Comment goes here.
Are you sure you want to

## ArrowPresentation Transcript

• fizzbuzz = runKleisli (Kleisli (const [1..100]) >>>arr(fizz>>>buzz+++buzz >>>((show|||const quot;Buzzquot;) |||(const quot;Fizzquot;|||const quot;FizzBuzzquot;)))) () fizz n = cond n 3 buzz n = cond n 5 cond n m = if n `mod` m == 0 then Right n else Left n
• fizzbuzz = runKleisli (Kleisli (const [1..100]) >>>arr(fizz>>>buzz+++buzz >>>((show|||const quot;Buzzquot;) |||(const quot;Fizzquot;|||const quot;FizzBuzzquot;)))) () fizz n = cond n 3 buzz n = cond n 5 cond n m = if n `mod` m == 0 then Right n else Left n
• binary n | n == 0 = “0” | True = loop ((snd&&&fst>>>app)&&&f) n f = snd>>>(func->cond(0==) >>>(const quot;quot;|||(((flip divMod 2) >>>((func>>>(++))***show))>>>app))) cond f = x -> if f x then Left x else Right x View slide
• binary n | n == 0 = quot;0quot; | True = loop ((snd&&&fst>>>app)&&&f) n f (_,func) = proc x -> if x == 0 then returnA -< quot;quot; else do let (y,z) = divMod x 2 returnA -< func y ++ show z View slide
• primes=loop ((snd&&&fst>>>app)&&&f) [2..] f =snd>>>(func-> (head&&&(head&&&tail)) >>>second(first(flip mod>>>(>>>(/=)0)) >>>uncurry filter>>>func)>>>uncurry (:))