Upcoming SlideShare
×

# Arrow

1,725 views

Published on

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
1,725
On SlideShare
0
From Embeds
0
Number of Embeds
203
Actions
Shares
0
17
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Arrow

1. 1. 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
2. 2. 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
3. 3. 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
4. 4. 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
5. 5. primes=loop ((snd&&&fst>>>app)&&&f) [2..] f =snd>>>(func-> (head&&&(head&&&tail)) >>>second(first(flip mod>>>(>>>(/=)0)) >>>uncurry filter>>>func)>>>uncurry (:))